[Scummvm-cvs-logs] CVS: scummvm Makefile,1.2.2.1,1.2.2.2 actor.cpp,1.4.2.1,1.4.2.2 boxes.cpp,1.2,1.2.2.1 copying.txt,1.1.1.1,1.1.1.1.2.1 costume.cpp,1.2.2.1,1.2.2.2 debug.cpp,1.7.2.1,1.7.2.2 gfx.cpp,1.3.2.2,1.3.2.3 object.cpp,1.2.2.1,1.2.2.2 readme.txt,1.2,1.2.2.1 resource.cpp,1.2.2.1,1.2.2.2 saveload.cpp,1.2.2.1,1.2.2.2 script.cpp,1.2.2.2,1.2.2.3 script_v1.cpp,1.11.2.1,1.11.2.2 script_v2.cpp,1.9.2.1,1.9.2.2 scumm.h,1.7.2.1,1.7.2.2 scummsys.h,1.3.2.1,1.3.2.2 scummvm.cpp,1.6.2.1,1.6.2.2 scummvm.dsp,1.2.2.1,1.2.2.2 sdl.cpp,1.7.2.2,1.7.2.3 sound.cpp,1.1.1.1.2.1,1.1.1.1.2.2 stdafx.cpp,1.1.1.1,1.1.1.1.2.1 stdafx.h,1.3.2.1,1.3.2.2 string.cpp,1.1.1.1.2.2,1.1.1.1.2.3 sys.cpp,1.2,1.2.2.1 verbs.cpp,1.2.2.1,1.2.2.2 whatsnew.txt,1.1.1.1,1.1.1.1.2.1

Vincent Hamm yazoo at users.sourceforge.net
Thu Dec 20 01:41:02 CET 2001


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv5518

Modified Files:
      Tag: exp_1
	Makefile actor.cpp boxes.cpp copying.txt costume.cpp debug.cpp 
	gfx.cpp object.cpp readme.txt resource.cpp saveload.cpp 
	script.cpp script_v1.cpp script_v2.cpp scumm.h scummsys.h 
	scummvm.cpp scummvm.dsp sdl.cpp sound.cpp stdafx.cpp stdafx.h 
	string.cpp sys.cpp verbs.cpp whatsnew.txt 
Log Message:
Resync with main branch, major FT fixes

Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** Makefile	2001/11/12 16:29:07	1.2.2.1
--- Makefile	2001/12/20 00:18:02	1.2.2.2
***************
*** 1,26 ****
! CC	= gcc
! CFLAGS	= -g -O2 -Wno-multichar
! DEFINES	= -DUNIX
! LDFLAGS = `sdl-config --libs`
! INCLUDES= `sdl-config --cflags`
! CPPFLAGS= $(DEFINES) $(INCLUDES)
! 
! INCS	= scumm.h scummsys.h stdafx.h
! 
! OBJS	= actor.o boxes.o costume.o gfx.o object.o resource.o \
! 	  saveload.o script.o scummvm.o sound.o string.o \
! 	  sys.o verbs.o sdl.o script_v7.o script_v1.o script_v2.o debug.o
! 	
! .cpp.o:
! 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $(<)
! 
! all: scummvm
! 
! scummvm: $(OBJS)
! 	$(CC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS)
! 
! clean:
! 	rm -f $(OBJS) scummvm
! 
! check:
! $(OBJS): $(INCS)
--- 1,41 ----
! # $Header$
! 
! CC      = gcc
! CFLAGS  = -g -Wno-multichar
! DEFINES = -DUNIX -DUSE_ADLIB
! LDFLAGS :=
! INCLUDES:= `sdl-config --cflags` -I./ -I./sound
! CPPFLAGS= $(DEFINES) $(INCLUDES)
! LIBS	= `sdl-config --libs` -lreadline -lncurses -lhistory -lm
! ZIPFILE := scummvm-`date '+%Y-%m-%d'`.zip
! 
! INCS	= scumm.h scummsys.h stdafx.h
! 
! OBJS	= actor.o boxes.o costume.o gfx.o object.o resource.o \
! 	saveload.o script.o scummvm.o sound.o string.o \
! 	sys.o verbs.o sdl.o script_v1.o script_v2.o debug.o gui.o \
! 	sound/imuse.o sound/fmopl.o sound/adlib.o sound/gmidi.o debugrl.o
! 
! DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \
! 	windows.cpp debugrl.h whatsnew.txt readme.txt copying.txt \
! 	scummvm.dsp scummvm.dsw
! 
! .cpp.o:
! 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
! 
! all: scummvm
! 
! scummvm: $(OBJS)
! 	$(CC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS)
! 
! $(OBJS): Makefile
! 
! clean:
! 	rm -f $(OBJS) scummvm
! 
! dist:
! 	rm -f $(ZIPFILE)
! 	zip -q $(ZIPFILE) $(DISTFILES)
! 
! check:
! $(OBJS): $(INCS)

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -C2 -d -r1.4.2.1 -r1.4.2.2
*** actor.cpp	2001/11/12 16:14:40	1.4.2.1
--- actor.cpp	2001/12/20 00:18:02	1.4.2.2
***************
*** 1,1075 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...2200 lines suppressed...]
! 
! 	if (from<0 || from>255 || to<0 || from>255 || to < from)
! 		error("setupShadowPalette: invalid range from %d to %d", from, to);
! 
! 	table = _shadowPalette + slot * 256;
! 	for(i=0; i<256; i++)
! 		table[i] = i;
! 
! 	table += from;
! 	curpal = _currentPalette + from*3;
! 	num = to - from + 1;
! 	do {
! 		*table++ = remapPaletteColor(
! 			curpal[0] * rfact >> 8,
! 			curpal[1] * gfact >> 8,
! 			curpal[2] * bfact >> 8,
! 			(uint)-1);
! 		curpal+=3;
! 	} while (--num);
  }

Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/boxes.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** boxes.cpp	2001/10/11 10:45:39	1.2
--- boxes.cpp	2001/12/20 00:18:02	1.2.2.1
***************
*** 1,842 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...1610 lines suppressed...]
! 	*_boxMatrixPtr1++ = b;
! }
! 
! void *Scumm::addToBoxVertexHeap(int size) {
! 	byte *ptr = _boxMatrixPtr4;
! 
! 	_boxMatrixPtr4 += size;
! 	_boxPathVertexHeapIndex += size;
! 
! 	if (_boxPathVertexHeapIndex >= _maxBoxVertexHeap)
! 		error("Box path vertex heap overflow");
! 
! 	return ptr;
! }
! 
! PathVertex *Scumm::addPathVertex() {
! 	_boxMatrixPtr4 = getResourceAddress(rtMatrix, 4);
! 	_boxPathVertexHeapIndex = 0;
! 	return (PathVertex*)addToBoxVertexHeap(sizeof(PathVertex));
! }

Index: copying.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/copying.txt,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -C2 -d -r1.1.1.1 -r1.1.1.1.2.1
*** copying.txt	2001/10/09 14:30:13	1.1.1.1
--- copying.txt	2001/12/20 00:18:02	1.1.1.1.2.1
***************
*** 1,341 ****
! 
!                     GNU GENERAL PUBLIC LICENSE
!                        Version 2, June 1991
! 
!  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
!                        59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
!  Everyone is permitted to copy and distribute verbatim copies
!  of this license document, but changing it is not allowed.
! 
!                             Preamble
! 
!   The licenses for most software are designed to take away your
! freedom to share and change it.  By contrast, the GNU General Public
! License is intended to guarantee your freedom to share and change free
! software--to make sure the software is free for all its users.  This
! General Public License applies to most of the Free Software
! Foundation's software and to any other program whose authors commit to
! using it.  (Some other Free Software Foundation software is covered by
! the GNU Library General Public License instead.)  You can apply it to
! your programs, too.
! 
!   When we speak of free software, we are referring to freedom, not
! price.  Our General Public Licenses are designed to make sure that you
! have the freedom to distribute copies of free software (and charge for
! this service if you wish), that you receive source code or can get it
! if you want it, that you can change the software or use pieces of it
! in new free programs; and that you know you can do these things.
! 
!   To protect your rights, we need to make restrictions that forbid
! anyone to deny you these rights or to ask you to surrender the rights.
! These restrictions translate to certain responsibilities for you if you
! distribute copies of the software, or if you modify it.
! 
!   For example, if you distribute copies of such a program, whether
! gratis or for a fee, you must give the recipients all the rights that
! you have.  You must make sure that they, too, receive or can get the
! source code.  And you must show them these terms so they know their
! rights.
! 
!   We protect your rights with two steps: (1) copyright the software, and
! (2) offer you this license which gives you legal permission to copy,
! distribute and/or modify the software.
! 
!   Also, for each author's protection and ours, we want to make certain
! that everyone understands that there is no warranty for this free
! software.  If the software is modified by someone else and passed on, we
! want its recipients to know that what they have is not the original, so
! that any problems introduced by others will not reflect on the original
! authors' reputations.
! 
!   Finally, any free program is threatened constantly by software
! patents.  We wish to avoid the danger that redistributors of a free
! program will individually obtain patent licenses, in effect making the
! program proprietary.  To prevent this, we have made it clear that any
! patent must be licensed for everyone's free use or not licensed at all.
! 
!   The precise terms and conditions for copying, distribution and
! modification follow.
! 
!                     GNU GENERAL PUBLIC LICENSE
!    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
! 
!   0. This License applies to any program or other work which contains
! a notice placed by the copyright holder saying it may be distributed
! under the terms of this General Public License.  The "Program", below,
! refers to any such program or work, and a "work based on the Program"
! means either the Program or any derivative work under copyright law:
! that is to say, a work containing the Program or a portion of it,
! either verbatim or with modifications and/or translated into another
! language.  (Hereinafter, translation is included without limitation in
! the term "modification".)  Each licensee is addressed as "you".
! 
! Activities other than copying, distribution and modification are not
! covered by this License; they are outside its scope.  The act of
! running the Program is not restricted, and the output from the Program
! is covered only if its contents constitute a work based on the
! Program (independent of having been made by running the Program).
! Whether that is true depends on what the Program does.
! 
!   1. You may copy and distribute verbatim copies of the Program's
! source code as you receive it, in any medium, provided that you
! conspicuously and appropriately publish on each copy an appropriate
! copyright notice and disclaimer of warranty; keep intact all the
! notices that refer to this License and to the absence of any warranty;
! and give any other recipients of the Program a copy of this License
! along with the Program.
! 
! You may charge a fee for the physical act of transferring a copy, and
! you may at your option offer warranty protection in exchange for a fee.
! 
!   2. You may modify your copy or copies of the Program or any portion
! of it, thus forming a work based on the Program, and copy and
! distribute such modifications or work under the terms of Section 1
! above, provided that you also meet all of these conditions:
! 
!     a) You must cause the modified files to carry prominent notices
!     stating that you changed the files and the date of any change.
! 
!     b) You must cause any work that you distribute or publish, that in
!     whole or in part contains or is derived from the Program or any
!     part thereof, to be licensed as a whole at no charge to all third
!     parties under the terms of this License.
! 
!     c) If the modified program normally reads commands interactively
!     when run, you must cause it, when started running for such
!     interactive use in the most ordinary way, to print or display an
!     announcement including an appropriate copyright notice and a
!     notice that there is no warranty (or else, saying that you provide
!     a warranty) and that users may redistribute the program under
!     these conditions, and telling the user how to view a copy of this
!     License.  (Exception: if the Program itself is interactive but
!     does not normally print such an announcement, your work based on
!     the Program is not required to print an announcement.)
! 
! These requirements apply to the modified work as a whole.  If
! identifiable sections of that work are not derived from the Program,
! and can be reasonably considered independent and separate works in
! themselves, then this License, and its terms, do not apply to those
! sections when you distribute them as separate works.  But when you
! distribute the same sections as part of a whole which is a work based
! on the Program, the distribution of the whole must be on the terms of
! this License, whose permissions for other licensees extend to the
! entire whole, and thus to each and every part regardless of who wrote it.
! 
! Thus, it is not the intent of this section to claim rights or contest
! your rights to work written entirely by you; rather, the intent is to
! exercise the right to control the distribution of derivative or
! collective works based on the Program.
! 
! In addition, mere aggregation of another work not based on the Program
! with the Program (or with a work based on the Program) on a volume of
! a storage or distribution medium does not bring the other work under
! the scope of this License.
! 
!   3. You may copy and distribute the Program (or a work based on it,
! under Section 2) in object code or executable form under the terms of
! Sections 1 and 2 above provided that you also do one of the following:
! 
!     a) Accompany it with the complete corresponding machine-readable
!     source code, which must be distributed under the terms of Sections
!     1 and 2 above on a medium customarily used for software interchange; or,
! 
!     b) Accompany it with a written offer, valid for at least three
!     years, to give any third party, for a charge no more than your
!     cost of physically performing source distribution, a complete
!     machine-readable copy of the corresponding source code, to be
!     distributed under the terms of Sections 1 and 2 above on a medium
!     customarily used for software interchange; or,
! 
!     c) Accompany it with the information you received as to the offer
!     to distribute corresponding source code.  (This alternative is
!     allowed only for noncommercial distribution and only if you
!     received the program in object code or executable form with such
!     an offer, in accord with Subsection b above.)
! 
! The source code for a work means the preferred form of the work for
! making modifications to it.  For an executable work, complete source
! code means all the source code for all modules it contains, plus any
! associated interface definition files, plus the scripts used to
! control compilation and installation of the executable.  However, as a
! special exception, the source code distributed need not include
! anything that is normally distributed (in either source or binary
! form) with the major components (compiler, kernel, and so on) of the
! operating system on which the executable runs, unless that component
! itself accompanies the executable.
! 
! If distribution of executable or object code is made by offering
! access to copy from a designated place, then offering equivalent
! access to copy the source code from the same place counts as
! distribution of the source code, even though third parties are not
! compelled to copy the source along with the object code.
! 
!   4. You may not copy, modify, sublicense, or distribute the Program
! except as expressly provided under this License.  Any attempt
! otherwise to copy, modify, sublicense or distribute the Program is
! void, and will automatically terminate your rights under this License.
! However, parties who have received copies, or rights, from you under
! this License will not have their licenses terminated so long as such
! parties remain in full compliance.
! 
!   5. You are not required to accept this License, since you have not
! signed it.  However, nothing else grants you permission to modify or
! distribute the Program or its derivative works.  These actions are
! prohibited by law if you do not accept this License.  Therefore, by
! modifying or distributing the Program (or any work based on the
! Program), you indicate your acceptance of this License to do so, and
! all its terms and conditions for copying, distributing or modifying
! the Program or works based on it.
! 
!   6. Each time you redistribute the Program (or any work based on the
! Program), the recipient automatically receives a license from the
! original licensor to copy, distribute or modify the Program subject to
! these terms and conditions.  You may not impose any further
! restrictions on the recipients' exercise of the rights granted herein.
! You are not responsible for enforcing compliance by third parties to
! this License.
! 
!   7. If, as a consequence of a court judgment or allegation of patent
! infringement or for any other reason (not limited to patent issues),
! conditions are imposed on you (whether by court order, agreement or
! otherwise) that contradict the conditions of this License, they do not
! excuse you from the conditions of this License.  If you cannot
! distribute so as to satisfy simultaneously your obligations under this
! License and any other pertinent obligations, then as a consequence you
! may not distribute the Program at all.  For example, if a patent
! license would not permit royalty-free redistribution of the Program by
! all those who receive copies directly or indirectly through you, then
! the only way you could satisfy both it and this License would be to
! refrain entirely from distribution of the Program.
! 
! If any portion of this section is held invalid or unenforceable under
! any particular circumstance, the balance of the section is intended to
! apply and the section as a whole is intended to apply in other
! circumstances.
! 
! It is not the purpose of this section to induce you to infringe any
! patents or other property right claims or to contest validity of any
! such claims; this section has the sole purpose of protecting the
! integrity of the free software distribution system, which is
! implemented by public license practices.  Many people have made
! generous contributions to the wide range of software distributed
! through that system in reliance on consistent application of that
! system; it is up to the author/donor to decide if he or she is willing
! to distribute software through any other system and a licensee cannot
! impose that choice.
! 
! This section is intended to make thoroughly clear what is believed to
! be a consequence of the rest of this License.
! 
!   8. If the distribution and/or use of the Program is restricted in
! certain countries either by patents or by copyrighted interfaces, the
! original copyright holder who places the Program under this License
! may add an explicit geographical distribution limitation excluding
! those countries, so that distribution is permitted only in or among
! countries not thus excluded.  In such case, this License incorporates
! the limitation as if written in the body of this License.
! 
!   9. The Free Software Foundation may publish revised and/or new versions
! of the General Public License from time to time.  Such new versions will
! be similar in spirit to the present version, but may differ in detail to
! address new problems or concerns.
! 
! Each version is given a distinguishing version number.  If the Program
! specifies a version number of this License which applies to it and "any
! later version", you have the option of following the terms and conditions
! either of that version or of any later version published by the Free
! Software Foundation.  If the Program does not specify a version number of
! this License, you may choose any version ever published by the Free Software
! Foundation.
! 
!   10. If you wish to incorporate parts of the Program into other free
! programs whose distribution conditions are different, write to the author
! to ask for permission.  For software which is copyrighted by the Free
! Software Foundation, write to the Free Software Foundation; we sometimes
! make exceptions for this.  Our decision will be guided by the two goals
! of preserving the free status of all derivatives of our free software and
! of promoting the sharing and reuse of software generally.
! 
!                             NO WARRANTY
! 
!   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
! FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
! OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
! PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
! OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
! MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
! TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
! PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
! REPAIR OR CORRECTION.
! 
!   12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
! WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
! REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
! INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
! OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
! TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
! YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
! PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGES.
! 
!                      END OF TERMS AND CONDITIONS
! 
!             How to Apply These Terms to Your New Programs
! 
!   If you develop a new program, and you want it to be of the greatest
! possible use to the public, the best way to achieve this is to make it
! free software which everyone can redistribute and change under these terms.
! 
!   To do so, attach the following notices to the program.  It is safest
! to attach them to the start of each source file to most effectively
! convey the exclusion of warranty; and each file should have at least
! the "copyright" line and a pointer to where the full notice is found.
! 
!     <one line to give the program's name and a brief idea of what it does.>
!     Copyright (C) 19yy  <name of author>
! 
!     This program is free software; you can redistribute it and/or modify
!     it under the terms of the GNU General Public License as published by
!     the Free Software Foundation; either version 2 of the License, or
!     (at your option) any later version.
! 
!     This program is distributed in the hope that it will be useful,
!     but WITHOUT ANY WARRANTY; without even the implied warranty of
!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!     GNU General Public License for more details.
! 
!     You should have received a copy of the GNU General Public License
!     along with this program; if not, write to the Free Software
!     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
! 
! 
! Also add information on how to contact you by electronic and paper mail.
! 
! If the program is interactive, make it output a short notice like this
! when it starts in an interactive mode:
! 
!     Gnomovision version 69, Copyright (C) 19yy name of author
!     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
!     This is free software, and you are welcome to redistribute it
!     under certain conditions; type `show c' for details.
! 
! The hypothetical commands `show w' and `show c' should show the appropriate
! parts of the General Public License.  Of course, the commands you use may
! be called something other than `show w' and `show c'; they could even be
! mouse-clicks or menu items--whatever suits your program.
! 
! You should also get your employer (if you work as a programmer) or your
! school, if any, to sign a "copyright disclaimer" for the program, if
! necessary.  Here is a sample; alter the names:
! 
!   Yoyodyne, Inc., hereby disclaims all copyright interest in the program
!   `Gnomovision' (which makes passes at compilers) written by James Hacker.
! 
!   <signature of Ty Coon>, 1 April 1989
!   Ty Coon, President of Vice
! 
! This General Public License does not permit incorporating your program into
! proprietary programs.  If your program is a subroutine library, you may
! consider it more useful to permit linking proprietary applications with the
! library.  If this is what you want to do, use the GNU Library General
! Public License instead of this License.
--- 1,341 ----
! 

!                     GNU GENERAL PUBLIC LICENSE

!                        Version 2, June 1991

! 

!  Copyright (C) 1989, 1991 Free Software Foundation, Inc.

!                        59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

!  Everyone is permitted to copy and distribute verbatim copies

!  of this license document, but changing it is not allowed.

! 

!                             Preamble

! 

!   The licenses for most software are designed to take away your

! freedom to share and change it.  By contrast, the GNU General Public

! License is intended to guarantee your freedom to share and change free

! software--to make sure the software is free for all its users.  This

! General Public License applies to most of the Free Software

! Foundation's software and to any other program whose authors commit to

! using it.  (Some other Free Software Foundation software is covered by

! the GNU Library General Public License instead.)  You can apply it to

! your programs, too.

! 

!   When we speak of free software, we are referring to freedom, not

! price.  Our General Public Licenses are designed to make sure that you

! have the freedom to distribute copies of free software (and charge for

! this service if you wish), that you receive source code or can get it

! if you want it, that you can change the software or use pieces of it

! in new free programs; and that you know you can do these things.

! 

!   To protect your rights, we need to make restrictions that forbid

! anyone to deny you these rights or to ask you to surrender the rights.

! These restrictions translate to certain responsibilities for you if you

! distribute copies of the software, or if you modify it.

! 

!   For example, if you distribute copies of such a program, whether

! gratis or for a fee, you must give the recipients all the rights that

! you have.  You must make sure that they, too, receive or can get the

! source code.  And you must show them these terms so they know their

! rights.

! 

!   We protect your rights with two steps: (1) copyright the software, and

! (2) offer you this license which gives you legal permission to copy,

! distribute and/or modify the software.

! 

!   Also, for each author's protection and ours, we want to make certain

! that everyone understands that there is no warranty for this free

! software.  If the software is modified by someone else and passed on, we

! want its recipients to know that what they have is not the original, so

! that any problems introduced by others will not reflect on the original

! authors' reputations.

! 

!   Finally, any free program is threatened constantly by software

! patents.  We wish to avoid the danger that redistributors of a free

! program will individually obtain patent licenses, in effect making the

! program proprietary.  To prevent this, we have made it clear that any

! patent must be licensed for everyone's free use or not licensed at all.

! 

!   The precise terms and conditions for copying, distribution and

! modification follow.

! 

!                     GNU GENERAL PUBLIC LICENSE

!    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

! 

!   0. This License applies to any program or other work which contains

! a notice placed by the copyright holder saying it may be distributed

! under the terms of this General Public License.  The "Program", below,

! refers to any such program or work, and a "work based on the Program"

! means either the Program or any derivative work under copyright law:

! that is to say, a work containing the Program or a portion of it,

! either verbatim or with modifications and/or translated into another

! language.  (Hereinafter, translation is included without limitation in

! the term "modification".)  Each licensee is addressed as "you".

! 

! Activities other than copying, distribution and modification are not

! covered by this License; they are outside its scope.  The act of

! running the Program is not restricted, and the output from the Program

! is covered only if its contents constitute a work based on the

! Program (independent of having been made by running the Program).

! Whether that is true depends on what the Program does.

! 

!   1. You may copy and distribute verbatim copies of the Program's

! source code as you receive it, in any medium, provided that you

! conspicuously and appropriately publish on each copy an appropriate

! copyright notice and disclaimer of warranty; keep intact all the

! notices that refer to this License and to the absence of any warranty;

! and give any other recipients of the Program a copy of this License

! along with the Program.

! 

! You may charge a fee for the physical act of transferring a copy, and

! you may at your option offer warranty protection in exchange for a fee.

! 

!   2. You may modify your copy or copies of the Program or any portion

! of it, thus forming a work based on the Program, and copy and

! distribute such modifications or work under the terms of Section 1

! above, provided that you also meet all of these conditions:

! 

!     a) You must cause the modified files to carry prominent notices

!     stating that you changed the files and the date of any change.

! 

!     b) You must cause any work that you distribute or publish, that in

!     whole or in part contains or is derived from the Program or any

!     part thereof, to be licensed as a whole at no charge to all third

!     parties under the terms of this License.

! 

!     c) If the modified program normally reads commands interactively

!     when run, you must cause it, when started running for such

!     interactive use in the most ordinary way, to print or display an

!     announcement including an appropriate copyright notice and a

!     notice that there is no warranty (or else, saying that you provide

!     a warranty) and that users may redistribute the program under

!     these conditions, and telling the user how to view a copy of this

!     License.  (Exception: if the Program itself is interactive but

!     does not normally print such an announcement, your work based on

!     the Program is not required to print an announcement.)

! 

! These requirements apply to the modified work as a whole.  If

! identifiable sections of that work are not derived from the Program,

! and can be reasonably considered independent and separate works in

! themselves, then this License, and its terms, do not apply to those

! sections when you distribute them as separate works.  But when you

! distribute the same sections as part of a whole which is a work based

! on the Program, the distribution of the whole must be on the terms of

! this License, whose permissions for other licensees extend to the

! entire whole, and thus to each and every part regardless of who wrote it.

! 

! Thus, it is not the intent of this section to claim rights or contest

! your rights to work written entirely by you; rather, the intent is to

! exercise the right to control the distribution of derivative or

! collective works based on the Program.

! 

! In addition, mere aggregation of another work not based on the Program

! with the Program (or with a work based on the Program) on a volume of

! a storage or distribution medium does not bring the other work under

! the scope of this License.

! 

!   3. You may copy and distribute the Program (or a work based on it,

! under Section 2) in object code or executable form under the terms of

! Sections 1 and 2 above provided that you also do one of the following:

! 

!     a) Accompany it with the complete corresponding machine-readable

!     source code, which must be distributed under the terms of Sections

!     1 and 2 above on a medium customarily used for software interchange; or,

! 

!     b) Accompany it with a written offer, valid for at least three

!     years, to give any third party, for a charge no more than your

!     cost of physically performing source distribution, a complete

!     machine-readable copy of the corresponding source code, to be

!     distributed under the terms of Sections 1 and 2 above on a medium

!     customarily used for software interchange; or,

! 

!     c) Accompany it with the information you received as to the offer

!     to distribute corresponding source code.  (This alternative is

!     allowed only for noncommercial distribution and only if you

!     received the program in object code or executable form with such

!     an offer, in accord with Subsection b above.)

! 

! The source code for a work means the preferred form of the work for

! making modifications to it.  For an executable work, complete source

! code means all the source code for all modules it contains, plus any

! associated interface definition files, plus the scripts used to

! control compilation and installation of the executable.  However, as a

! special exception, the source code distributed need not include

! anything that is normally distributed (in either source or binary

! form) with the major components (compiler, kernel, and so on) of the

! operating system on which the executable runs, unless that component

! itself accompanies the executable.

! 

! If distribution of executable or object code is made by offering

! access to copy from a designated place, then offering equivalent

! access to copy the source code from the same place counts as

! distribution of the source code, even though third parties are not

! compelled to copy the source along with the object code.

! 

!   4. You may not copy, modify, sublicense, or distribute the Program

! except as expressly provided under this License.  Any attempt

! otherwise to copy, modify, sublicense or distribute the Program is

! void, and will automatically terminate your rights under this License.

! However, parties who have received copies, or rights, from you under

! this License will not have their licenses terminated so long as such

! parties remain in full compliance.

! 

!   5. You are not required to accept this License, since you have not

! signed it.  However, nothing else grants you permission to modify or

! distribute the Program or its derivative works.  These actions are

! prohibited by law if you do not accept this License.  Therefore, by

! modifying or distributing the Program (or any work based on the

! Program), you indicate your acceptance of this License to do so, and

! all its terms and conditions for copying, distributing or modifying

! the Program or works based on it.

! 

!   6. Each time you redistribute the Program (or any work based on the

! Program), the recipient automatically receives a license from the

! original licensor to copy, distribute or modify the Program subject to

! these terms and conditions.  You may not impose any further

! restrictions on the recipients' exercise of the rights granted herein.

! You are not responsible for enforcing compliance by third parties to

! this License.

! 

!   7. If, as a consequence of a court judgment or allegation of patent

! infringement or for any other reason (not limited to patent issues),

! conditions are imposed on you (whether by court order, agreement or

! otherwise) that contradict the conditions of this License, they do not

! excuse you from the conditions of this License.  If you cannot

! distribute so as to satisfy simultaneously your obligations under this

! License and any other pertinent obligations, then as a consequence you

! may not distribute the Program at all.  For example, if a patent

! license would not permit royalty-free redistribution of the Program by

! all those who receive copies directly or indirectly through you, then

! the only way you could satisfy both it and this License would be to

! refrain entirely from distribution of the Program.

! 

! If any portion of this section is held invalid or unenforceable under

! any particular circumstance, the balance of the section is intended to

! apply and the section as a whole is intended to apply in other

! circumstances.

! 

! It is not the purpose of this section to induce you to infringe any

! patents or other property right claims or to contest validity of any

! such claims; this section has the sole purpose of protecting the

! integrity of the free software distribution system, which is

! implemented by public license practices.  Many people have made

! generous contributions to the wide range of software distributed

! through that system in reliance on consistent application of that

! system; it is up to the author/donor to decide if he or she is willing

! to distribute software through any other system and a licensee cannot

! impose that choice.

! 

! This section is intended to make thoroughly clear what is believed to

! be a consequence of the rest of this License.

! 

!   8. If the distribution and/or use of the Program is restricted in

! certain countries either by patents or by copyrighted interfaces, the

! original copyright holder who places the Program under this License

! may add an explicit geographical distribution limitation excluding

! those countries, so that distribution is permitted only in or among

! countries not thus excluded.  In such case, this License incorporates

! the limitation as if written in the body of this License.

! 

!   9. The Free Software Foundation may publish revised and/or new versions

! of the General Public License from time to time.  Such new versions will

! be similar in spirit to the present version, but may differ in detail to

! address new problems or concerns.

! 

! Each version is given a distinguishing version number.  If the Program

! specifies a version number of this License which applies to it and "any

! later version", you have the option of following the terms and conditions

! either of that version or of any later version published by the Free

! Software Foundation.  If the Program does not specify a version number of

! this License, you may choose any version ever published by the Free Software

! Foundation.

! 

!   10. If you wish to incorporate parts of the Program into other free

! programs whose distribution conditions are different, write to the author

! to ask for permission.  For software which is copyrighted by the Free

! Software Foundation, write to the Free Software Foundation; we sometimes

! make exceptions for this.  Our decision will be guided by the two goals

! of preserving the free status of all derivatives of our free software and

! of promoting the sharing and reuse of software generally.

! 

!                             NO WARRANTY

! 

!   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY

! FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN

! OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES

! PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED

! OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

! MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS

! TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE

! PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,

! REPAIR OR CORRECTION.

! 

!   12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING

! WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR

! REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,

! INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING

! OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED

! TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY

! YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER

! PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE

! POSSIBILITY OF SUCH DAMAGES.

! 

!                      END OF TERMS AND CONDITIONS

! 

!             How to Apply These Terms to Your New Programs

! 

!   If you develop a new program, and you want it to be of the greatest

! possible use to the public, the best way to achieve this is to make it

! free software which everyone can redistribute and change under these terms.

! 

!   To do so, attach the following notices to the program.  It is safest

! to attach them to the start of each source file to most effectively

! convey the exclusion of warranty; and each file should have at least

! the "copyright" line and a pointer to where the full notice is found.

! 

!     <one line to give the program's name and a brief idea of what it does.>

!     Copyright (C) 19yy  <name of author>

! 

!     This program is free software; you can redistribute it and/or modify

!     it under the terms of the GNU General Public License as published by

!     the Free Software Foundation; either version 2 of the License, or

!     (at your option) any later version.

! 

!     This program is distributed in the hope that it will be useful,

!     but WITHOUT ANY WARRANTY; without even the implied warranty of

!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

!     GNU General Public License for more details.

! 

!     You should have received a copy of the GNU General Public License

!     along with this program; if not, write to the Free Software

!     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

! 

! 

! Also add information on how to contact you by electronic and paper mail.

! 

! If the program is interactive, make it output a short notice like this

! when it starts in an interactive mode:

! 

!     Gnomovision version 69, Copyright (C) 19yy name of author

!     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.

!     This is free software, and you are welcome to redistribute it

!     under certain conditions; type `show c' for details.

! 

! The hypothetical commands `show w' and `show c' should show the appropriate

! parts of the General Public License.  Of course, the commands you use may

! be called something other than `show w' and `show c'; they could even be

! mouse-clicks or menu items--whatever suits your program.

! 

! You should also get your employer (if you work as a programmer) or your

! school, if any, to sign a "copyright disclaimer" for the program, if

! necessary.  Here is a sample; alter the names:

! 

!   Yoyodyne, Inc., hereby disclaims all copyright interest in the program

!   `Gnomovision' (which makes passes at compilers) written by James Hacker.

! 

!   <signature of Ty Coon>, 1 April 1989

!   Ty Coon, President of Vice

! 

! This General Public License does not permit incorporating your program into

! proprietary programs.  If your program is a subroutine library, you may

! consider it more useful to permit linking proprietary applications with the

! library.  If this is what you want to do, use the GNU Library General

! Public License instead of this License.


Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/costume.cpp,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** costume.cpp	2001/11/12 16:16:57	1.2.2.1
--- costume.cpp	2001/12/20 00:18:02	1.2.2.2
***************
*** 1,794 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...1635 lines suppressed...]
! 					} else if (cmd==0x79) {
! 						a->cost.stopped |= (1<<i);
! 					} else {
! 						a->cost.curpos[i] = a->cost.start[i] = j;
! 						a->cost.end[i] = j + (extra&0x7F);
! 						if (extra&0x80)
! 							a->cost.curpos[i] |= 0x8000;
! 						a->cost.frame[i] = frame;
! 					}
! 				}
! 			} else {
! 				if (j!=0xFFFF)
! 					r++;
! 			}
! 		}
! 		i++;
! 		usemask <<= 1;
! 		mask <<= 1;
! 	} while ((uint16)mask);
! }

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/debug.cpp,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -C2 -d -r1.7.2.1 -r1.7.2.2
*** debug.cpp	2001/11/12 16:27:25	1.7.2.1
--- debug.cpp	2001/12/20 00:18:03	1.7.2.2
***************
*** 1,201 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * Change Log:
!  * $Log$
!  * Revision 1.7.2.1  2001/11/12 16:27:25  yazoo
!  * The dig and Full Throttle support
!  *
!  * Revision 1.3  2001/10/26 17:34:50  strigeus
!  * bug fixes, code cleanup
!  *
!  * Revision 1.2  2001/10/23 19:56:57  strigeus
!  * fixed spelling error
!  *
!  * Revision 1.1  2001/10/23 19:51:50  strigeus
!  * recompile not needed when switching games
!  * debugger skeleton implemented
!  *
!  *
!  */
! 
! #include "stdafx.h"
! #include "scumm.h"
! 
! 
! enum {
! 	CMD_INVALID,
! 	CMD_HELP,
! 	CMD_QUIT,
! 	CMD_GO,
! 	CMD_ACTOR,
! 	CMD_SCRIPTS,
! };
! 
! void ScummDebugger::attach(Scumm *s) {
! 	if (_s)
! 		detach();
! 
! 	_welcome = true;
! 	_s = s;
! 	s->_debugger = this;
! 
! 	_go_amount = 1;
! }
! 
! bool ScummDebugger::do_command() {
! 	int cmd;
! 
! 	switch(get_command()) {
! 	case CMD_HELP:
! 		printf("Debugger commands:\n"
! 		       "help -> display this help text\n"
! 			   "quit -> quit the debugger\n"
! 			   "go [numframes] -> increase frame\n"
! 			   );
! 		return true;
! 
! 	case CMD_QUIT:
! 		detach();
! 		return false;
! 
! 	case CMD_GO:
! 		if (!_parameters[0])
! 			_go_amount = 1;
! 		else
! 			_go_amount = atoi(_parameters);
! 		return false;
! 	case CMD_ACTOR:
! 		if (!_parameters[0])
! 			printActors(-1);
! 		else
! 			printActors(atoi(_parameters));
! 		return true;
! 	case CMD_SCRIPTS:
! 		printScripts();
! 		return true;
  	}
  
! 	return true;
! }
! 
! void ScummDebugger::enter() {
! 	if (_welcome) {
! 		_welcome = false;
! 		printf("Debugging Mode entered!, please switch to this console for input.\n"
! 		       "Enter h to list all the debug commands\n");
! 	}
! 	while(do_command()) {}
! }
! 
! 
! void ScummDebugger::on_frame() {
! 	if (_go_amount==0)
! 		return;
! 	if (!--_go_amount)
! 		enter();
! }
! 
! 
! void ScummDebugger::detach() {
! 	_s->_debugger = NULL;
! 	_s = NULL;
! }
! 
! struct DebuggerCommands {
! 	char text[8];
! 	byte len;
! 	byte id;
! };
! 
! static const DebuggerCommands debugger_commands[] = {
! 	{ "h", 1, CMD_HELP },
! 	{ "q", 1, CMD_QUIT },
! 	{ "g", 1, CMD_GO },
! 	{ "a", 1, CMD_ACTOR },
! 	{ "s", 1, CMD_SCRIPTS },
! 	{ 0, 0, 0 },
! };
! 
! int ScummDebugger::get_command() {
! 	const DebuggerCommands *dc;
! 	char *s;
! 	int i;
! 
! 	do {
! 		printf("debug> ");
! 		if (!fgets(_cmd_buffer, sizeof(_cmd_buffer), stdin))
! 			return CMD_QUIT;
! 
! 		i = strlen(_cmd_buffer);
! 		while (i>0 && _cmd_buffer[i-1]==10)
! 			_cmd_buffer[--i] = 0;
! 
! 		if (i==0)
! 			continue;
! 						
! 		dc = debugger_commands;
! 		do {
! 			if (!strncmp(_cmd_buffer, dc->text, dc->len)) {
! 				for(s=_cmd_buffer;*s;s++) {
! 					if (*s==32) { s++; break; }
! 				}
! 				_parameters = s;
! 				return _command = dc->id;
! 			}
! 		} while ((++dc)->text[0]);
! 		
! 		for(s=_cmd_buffer;*s;s++)
! 			if (*s==32) { *s=0; break; }
! 		printf("Invalid command '%s'. Type 'help' for a list of available commands.\n", _cmd_buffer);
! 	} while (1);
! }
! 
! void ScummDebugger::printActors(int act) {
! 	int i;
! 	Actor *a;
! 
! 	if (act==-1) {
! 		printf("+--------------------------------------------------------------+\n");
! 		printf("|# |room|  x y   |elev|cos|width|box|mov|zp|frame|scale|spd|dir|\n");
! 		printf("+--+----+--------+----+---+-----+---+---+--+-----+-----+---+---+\n");
! 		for(i=1; i<_s->_maxActors; i++) {
! 			a = &_s->actor[i];
! 			if (a->visible)
! 				printf("|%2d|%4d|%3d  %3d|%4d|%3d|%5d|%3d|%3d|%2d|%5d|%5d|%3d|%3d|\n",
! 					i,a->room,a->x,a->y,a->elevation,a->costume,a->width,a->walkbox,a->moving,a->neverZClip,a->animIndex,a->scalex,a->speedx,a->facing);
! 		}
! 		printf("+--------------------------------------------------------------+\n");
! 	}
! }
! 
! void ScummDebugger::printScripts() {
! 	int i;
! 	ScriptSlot *ss;
! 
! 	printf("+----------------------------------+\n");
! 	printf("|# |num |sta|typ|un1|un2|fc|cut|un5|\n");
! 	printf("+--+----+---+---+---+---+--+---+---+\n");
! 	for(i=0; i<25; i++) {
! 		ss = &_s->vm.slot[i];
! 		if (ss->number) {
! 			printf("|%2d|%4d|%3d|%3d|%3d|%3d|%2d|%3d|%3d|\n",
! 				i, ss->number, ss->status, ss->type, ss->unk1, ss->unk2, ss->freezeCount, ss->cutsceneOverride, ss->unk5);
! 		}
! 	}
! 	printf("+----------------------------------+\n");
! }
\ No newline at end of file
--- 1,236 ----
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * $Header$
!  */
! 
! /*
!  * Readline and command completion support by Tom Dunstan <tommyd at senet.com.au>
!  */
! 
! 
! #include "stdafx.h"
! #include "scumm.h"
! 
! #ifdef HAVE_READLINE
! #include "debugrl.h"
! #endif
! 
! enum {
! 	CMD_INVALID,
! 	CMD_HELP,
! 	CMD_QUIT,
! 	CMD_GO,
! 	CMD_ACTOR,
! 	CMD_SCRIPTS,
! 	CMD_LOAD_ROOM,
! 	CMD_EXIT
! };
! 
! void ScummDebugger::attach(Scumm *s) {
! 	if (_s)
! 		detach();
! 
! 	_welcome = true;
! 	_s = s;
! 	s->_debugger = this;
! 
! 	_go_amount = 1;
! #ifdef HAVE_READLINE
! 	initialize_readline();
! #endif
! }
! 
! bool ScummDebugger::do_command() {
! 	int cmd;
! 
! 	switch(get_command()) {
! 	case CMD_HELP:
! 		printf(
! 				"Debugger commands:\n"
! 				"(h)elp -> display this help text\n"
! 				"(q)uit -> quit the debugger\n"
! 				"(g)o [numframes] -> increase frame\n"
! 				"(a)ctor [actornum] -> show actor information\n"
! 				"(r)oom roomnum -> load room\n"
! 				"(s)cripts -> show running scripts\n"
! 				"(e)xit -> exit game\n"
! 			   );
! 		return true;
! 
! 	case CMD_QUIT:
! 		detach();
! 		return false;
! 
! 	case CMD_GO:
! 		if (!_parameters[0])
! 			_go_amount = 1;
! 		else
! 			_go_amount = atoi(_parameters);
! 		return false;
! 	case CMD_ACTOR:
! 		if (!_parameters[0])
! 			printActors(-1);
! 		else
! 			printActors(atoi(_parameters));
! 		return true;
! 	case CMD_SCRIPTS:
! 		printScripts();
! 		return true;
! 	case CMD_LOAD_ROOM:
! 		if (!_parameters[0]) {
! 			printf("Enter a room number...\n");
! 		} else {	
! 			int room=atoi(_parameters);
! 			_s->actor[_s->_vars[VAR_EGO]].room=room;
! 			_s->startScene(room, 0, 0);
! 			_s->_fullRedraw = 1;
! 		}
! 		return true;
! 
! 	case CMD_EXIT:
! 		exit(1);
  	}
+ 	/* this line is never reached */
+ }
  
! void ScummDebugger::enter() {
! 	if (_welcome) {
! 		_welcome = false;
! 		printf("Debugging Mode entered!, please switch to this console for input.\n"
! 		       "Enter h to list all the debug commands\n");
! 	}
! 	while(do_command()) {}
! }
! 
! 
! void ScummDebugger::on_frame() {
! 	if (_go_amount==0)
! 		return;
! 	if (!--_go_amount)
! 		enter();
! }
! 
! 
! void ScummDebugger::detach() {
! 	_s->_debugger = NULL;
! 	_s = NULL;
! }
! 
! struct DebuggerCommands {
! 	char text[8];
! 	byte len;
! 	byte id;
! };
! 
! static const DebuggerCommands debugger_commands[] = {
! 	{ "h", 1, CMD_HELP },
! 	{ "q", 1, CMD_QUIT },
! 	{ "g", 1, CMD_GO },
! 	{ "a", 1, CMD_ACTOR },
! 	{ "s", 1, CMD_SCRIPTS },
! 	{ "r", 1, CMD_LOAD_ROOM },
! 	{ "e", 1, CMD_EXIT },
! 	{ 0, 0, 0 },
! };
! 
! int ScummDebugger::get_command() {
! 	const DebuggerCommands *dc;
! 	char *s;
! 	int i;
! 	static char *buf;
! 
! 	do {
! #ifndef HAVE_READLINE
! 		buf = _cmd_buffer;
! 		printf("debug> ");
! 		if (!fgets(_cmd_buffer, sizeof(_cmd_buffer), stdin))
! 			return CMD_QUIT;
! 
! 		i = strlen(_cmd_buffer);
! 		while (i>0 && _cmd_buffer[i-1]==10)
! 			_cmd_buffer[--i] = 0;
! 
! 		if (i==0)
! 			continue;
! 					
! #else // yes we do have readline
! 		if(buf) {
! 		  free(buf);
! 		}
! 		buf = readline("debug> ");
! 		if(!buf) {
! 		  printf("\n");
! 		  return CMD_QUIT;
! 		}
! 		if(strlen(buf) == 0) {
! 			continue;
! 		}
! 		add_history(buf);
! #endif
! 
! 		dc = debugger_commands;
! 		do {
! 			if (!strncmp(buf, dc->text, dc->len)) {
! 				for(s=buf;*s;s++) {
! 					if (*s==32) { s++; break; }
! 				}
! 				_parameters = s;
! 				return _command = dc->id;
! 			}
! 		} while ((++dc)->text[0]);
! 		
! 		for(s=buf;*s;s++)
! 			if (*s==32) { *s=0; break; }
! 		printf("Invalid command '%s'. Type 'help' for a list of available commands.\n", buf);
! 	} while (1);
! }
! 
! void ScummDebugger::printActors(int act) {
! 	int i;
! 	Actor *a;
! 
! 	printf("+--------------------------------------------------------------+\n");
! 	printf("|# |room|  x y   |elev|cos|width|box|mov|zp|frame|scale|spd|dir|\n");
! 	printf("+--+----+--------+----+---+-----+---+---+--+-----+-----+---+---+\n");
! 	for(i=1; i<NUM_ACTORS; i++) {
! 		if (act==-1 || act==i) {
! 			a = &_s->actor[i];
! 			if (a->visible)
! 				printf("|%2d|%4d|%3d  %3d|%4d|%3d|%5d|%3d|%3d|%2d|%5d|%5d|%3d|%3d|\n",
! 					i,a->room,a->x,a->y,a->elevation,a->costume,a->width,a->walkbox,a->moving,a->forceClip,a->frame,a->scalex,a->speedx,a->facing);
! 		}
! 	}
! 	printf("+--------------------------------------------------------------+\n");
! }
! 
! void ScummDebugger::printScripts() {
! 	int i;
! 	ScriptSlot *ss;
! 
! 	printf("+---------------------------------+\n");
! 	printf("|# |num|sta|typ|un1|un2|fc|cut|un5|\n");
! 	printf("+--+---+---+---+---+---+--+---+---+\n");
! 	for(i=0; i<25; i++) {
! 		ss = &_s->vm.slot[i];
! 		if (ss->number) {
! 			printf("|%2d|%3d|%3d|%3d|%3d|%3d|%2d|%3d|%3d|\n",
! 				i, ss->number, ss->status, ss->where, ss->unk1, ss->unk2, ss->freezeCount, ss->cutsceneOverride, ss->unk5);
! 		}
! 	}
! 	printf("+---------------------------------+\n");
! }

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -C2 -d -r1.3.2.2 -r1.3.2.3
*** gfx.cpp	2001/11/12 16:17:20	1.3.2.2
--- gfx.cpp	2001/12/20 00:18:03	1.3.2.3
***************
*** 1,1894 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...4085 lines suppressed...]
! 							} while (++x,--num);
! 						} else {
! 							x += num;
! 						}
! 					} else {
! 						do {
! 							if ((color=*src++) != 255 && (uint)x < (uint)bd->outwidth)
! 								dest[x] = color;
! 						} while (++x,--num);
! 					}
! 				} while (len);
! 			} while (dest += bd->outwidth,y++,--h);
! 		}
! 	} else {
! 		/* scaling of bomp images not supported yet */
! 	}
! 	CHECK_HEAP
! 
! }
\ No newline at end of file

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** object.cpp	2001/11/12 16:17:38	1.2.2.1
--- object.cpp	2001/12/20 00:18:03	1.2.2.2
***************
*** 1,803 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...1829 lines suppressed...]
! 	obim_size = READ_BE_UINT32_UNALIGNED(foir.obim + 4);
! 	flob_size = obcd_size + obim_size + 8;
! 
! 	/* Allocate slot & memory for floating object */
! 	slot = findFlObjectSlot();
! 	createResource(rtFlObject, slot, flob_size);
! 
! 	/* Copy object code + object image to floating object */
! 	roomptr = getResourceAddress(rtRoom, room);
! 	flob = getResourceAddress(rtFlObject, slot);
! 	((uint32*)flob)[0] = MKID('FLOB');
! 	((uint32*)flob)[1] = TO_BE_32(flob_size);
! 	memcpy(flob + 8, roomptr - foir.roomptr + foir.obcd, obcd_size);
! 	memcpy(flob + 8 + obcd_size, roomptr - foir.roomptr + foir.obim, obim_size);
! 
! 	/* Setup local object flags */
! 	setupRoomObject(od, flob);
! 
! 	od->fl_object_index = slot;
! }

Index: readme.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/readme.txt,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** readme.txt	2001/10/10 10:02:33	1.2
--- readme.txt	2001/12/20 00:18:03	1.2.2.1
***************
*** 1,20 ****
! 2001-10-08
  
! This is the first pre-alpha release of ScummVM. It is an implementation of the SCUMM engine used in various Lucas Arts games such as Monkey Island and Day of the Tentacle.
  
! The engine is far from complete, and thus only Monkey Island 2 is supported at the moment.
  
! Please be aware that the engine contains bugs and non-implemented-features that make it impossible to finish the game. Other stuff that's missing is sound and savegames.
  
  Compiling:
! --------
! You need SDL-1.2.2 (maybe older versions will work), and a supported compiler. At the moment only GCC and Microsoft Visual C++ are supported.
  
  GCC:
  ----
! * Type make (or gmake if that's what GNU make is called on your system) and hopefully ScummVM will compile for you.
! 
! Please note that big endian support is preliminary and contains bugs.
! 
  
  Microsoft Visual C++:
--- 1,26 ----
! 2001-11-6
  
! ScummVM is an implementation of the SCUMM engine used in various Lucas Arts games
! such as Monkey Island and Day of the Tentacle.
  
! At the moment the following games have been reported to work:
! Monkey Island 1 (CD version)
! Monkey Island 2
! Indiana Jones And The Fate Of Atlantis
! Day Of The Tentacle
! Sam & Max (partially)
  
! Please be aware that the engine contains bugs and non-implemented-features that
! make it impossible to finish the game. Other stuff that's missing is music.
  
  Compiling:
! ----------
! You need SDL-1.2.2 (maybe older versions will work), and a supported compiler. At
! the moment only GCC and Microsoft Visual C++ are supported.
  
  GCC:
  ----
! * Type make (or gmake if that's what GNU make is called on your system) and
! hopefully ScummVM will compile for you.
  
  Microsoft Visual C++:
***************
*** 30,33 ****
--- 36,54 ----
  --------
  Before you run the engine, you need to put the game's datafiles in the same directory as the scummvm executable. The filenames must be in lowercase (monkey2.000 and monkey2.001).
+ 
+ You can use Ctrl 0-9 and Shift 0-9 to load and save states.
+ Ctrl-z quits, and Ctrl-f runs in fast mode.
+ Ctrl-d starts the debugger.
+ Ctrl-s shows memory consumption.
+ 
+ 
+ Playing sound with Timidity:
+ ----------------------------
+ Start Timidity with the following command line :
+ 
+ $ timidity -irv 7777
+ 
+ Then just start ScummVM and you should have sound.
+ 
  
  Good Luck,

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** resource.cpp	2001/11/12 16:17:54	1.2.2.1
--- resource.cpp	2001/12/20 00:18:03	1.2.2.2
***************
*** 1,374 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...1850 lines suppressed...]
! #if defined(FULL_THROTTLE)
! 	allocResTypeData(rtCostume, MKID('AKOS'), _numCostumes, "costume", 1);
! #else
! 	allocResTypeData(rtCostume, MKID('COST'), _numCostumes, "costume", 1);
! #endif
! 	allocResTypeData(rtRoom, MKID('ROOM'), _numRooms, "room", 1);
! 	allocResTypeData(rtSound, MKID('SOUN'), _numSounds, "sound", 1);
! 	allocResTypeData(rtScript, MKID('SCRP'), _numScripts, "script", 1);
! 	allocResTypeData(rtCharset, MKID('CHAR'), _numCharsets, "charset", 1);
! 	allocResTypeData(rtObjectName, MKID('NONE'),_numNewNames,"new name", 0);
! 	allocResTypeData(rtInventory, MKID('NONE'),	_numInventory, "inventory", 0);
! 	allocResTypeData(rtTemp,MKID('NONE'),10, "temp", 0);
! 	allocResTypeData(rtScaleTable,MKID('NONE'),5, "scale table", 0);
! 	allocResTypeData(rtActorName, MKID('NONE'),NUM_ACTORS,"actor name", 0);
! 	allocResTypeData(rtBuffer, MKID('NONE'),10,"buffer", 0);
!  	allocResTypeData(rtVerb, MKID('NONE'),_numVerbs,"verb", 0);
! 	allocResTypeData(rtString, MKID('NONE'),_numArray,"array", 0);
! 	allocResTypeData(rtFlObject, MKID('NONE'),_numFlObject,"flobject", 0);
! 	allocResTypeData(rtMatrix, MKID('NONE'),10,"boxes", 0);
  }

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saveload.cpp,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** saveload.cpp	2001/11/12 16:19:14	1.2.2.1
--- saveload.cpp	2001/12/20 00:18:03	1.2.2.2
***************
*** 1,598 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...1276 lines suppressed...]
! 				ptr = *((void**)at);
! 				saveWord(ptr ? ((*_save_ref)(_ref_me, type, ptr ) + 1) : 0);
! 			} else {
! 				/* load reference */
! 				num = loadWord();
! 				*((void**)at) = num ? (*_load_ref)(_ref_me, type, num-1) : NULL;
! 			}
! 		} else {
! 			replen = 1;
! 			if (type&128) {
! 				sle++;
! 				replen = sle->offs;
! 				type&=~128;
! 			}
! 			saveLoadArrayOf(at, replen, size, type);
! 		}
! 		sle++;
! 	}
! }
! 

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script.cpp,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -C2 -d -r1.2.2.2 -r1.2.2.3
*** script.cpp	2001/11/12 16:19:39	1.2.2.2
--- script.cpp	2001/12/20 00:18:03	1.2.2.3
***************
*** 1,993 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...2021 lines suppressed...]
! 
! #else
! void Scumm::doSentence(int c, int b, int a) {
! 	SentenceTab *st;
! 
! 	st = &sentence[_sentenceNum++];
! 
! 	st->unk5 = c;
! 	st->unk4 = b;
! 	st->unk3 = a;
! 
! 	if (!(st->unk3&0xFF00))
! 		st->unk2 = 0;
! 	else
! 		st->unk2 = 1;
! 
! 	st->unk = 0;
! }
! #endif
\ No newline at end of file

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -C2 -d -r1.11.2.1 -r1.11.2.2
*** script_v1.cpp	2001/11/12 16:26:16	1.11.2.1
--- script_v1.cpp	2001/12/20 00:18:03	1.11.2.2
***************
*** 1,2003 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...3971 lines suppressed...]
! 			case 2: unkMessage1(); break;
! 			case 3: unkMessage2(); break;
! 			}
! 			_scriptPointer = _messagePtr;
! 			return;
! 		default:
! 			return;
! 		}
! 	}
! 
! 	string[textSlot].t_xpos = string[textSlot].xpos;
! 	string[textSlot].t_ypos = string[textSlot].ypos;
! 	string[textSlot].t_center = string[textSlot].center;
! 	string[textSlot].t_overhead = string[textSlot].overhead;
! 	string[textSlot].t_right = string[textSlot].right;
! 	string[textSlot].t_color = string[textSlot].color;
! 	string[textSlot].t_charset = string[textSlot].charset;
! }
! 
! 

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v2.cpp,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -C2 -d -r1.9.2.1 -r1.9.2.2
*** script_v2.cpp	2001/11/12 16:26:47	1.9.2.1
--- script_v2.cpp	2001/12/20 00:18:03	1.9.2.2
***************
*** 1,2134 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...4587 lines suppressed...]
! 	case 0xFE:
! 		setStringVars(m);
! 		if (n)
! 			_actorToPrintStrFor = pop();
! 		return;
! 	case 0xFF:
! 		string[m].t_xpos = string[m].xpos;
! 		string[m].t_ypos = string[m].ypos;
! 		string[m].t_center = string[m].center;
! 		string[m].t_overhead = string[m].overhead;
! 		string[m].t_no_talk_anim = string[m].no_talk_anim;
! 		string[m].t_right = string[m].right;
! 		string[m].t_color = string[m].color;
! 		string[m].t_charset = string[m].charset;
! 		return;
! 	default:
! 		error("decodeParseString: default case");
! 	}
! }
! 

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -C2 -d -r1.7.2.1 -r1.7.2.2
*** scumm.h	2001/11/12 16:20:05	1.7.2.1
--- scumm.h	2001/12/20 00:18:03	1.7.2.2
***************
*** 1,1883 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...4046 lines suppressed...]
! #if defined(__GNUC__)
! void CDECL error(const char *s, ...) NORETURN;
! #else
! void CDECL NORETURN error(const char *s, ...);
! #endif
! 
! void CDECL warning(const char *s, ...);
! void CDECL debug(int level, const char *s, ...);
! void checkHeap();
! void initGraphics(Scumm *s, bool fullScreen);
! void updateScreen(Scumm *s);
! void drawMouse(Scumm *s, int x, int y, int color, byte *mask, bool visible);
! void drawMouse(Scumm *s, int x, int y, int w, int h, byte *buf, bool visible);
! void blit(byte *dst, byte *src, int w, int h);
! byte *findResource(uint32 tag, byte *searchin, int index);
! byte *findResource(uint32 tag, byte *searchin);
! void playSfxSound(void *sound, uint32 size, uint rate);
! bool isSfxFinished();
! void waitForTimer(Scumm *s, int msec_delay);
\ No newline at end of file

Index: scummsys.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummsys.h,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -d -r1.3.2.1 -r1.3.2.2
*** scummsys.h	2001/11/12 16:20:15	1.3.2.1
--- scummsys.h	2001/12/20 00:18:03	1.3.2.2
***************
*** 1,203 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * Change Log:
!  * $Log$
!  * Revision 1.3.2.1  2001/11/12 16:20:15  yazoo
!  * The dig and Full Throttle support
!  *
!  * Revision 1.5  2001/10/23 19:51:50  strigeus
!  * recompile not needed when switching games
!  * debugger skeleton implemented
!  *
!  * Revision 1.4  2001/10/16 10:01:47  strigeus
!  * preliminary DOTT support
!  *
!  * Revision 1.3  2001/10/09 18:35:02  strigeus
!  * fixed object parent bug
!  * fixed some signed/unsigned comparisons
!  *
!  * Revision 1.2  2001/10/09 17:38:20  strigeus
!  * Autodetection of endianness.
!  *
!  * Revision 1.1.1.1  2001/10/09 14:30:14  strigeus
!  * initial revision
!  *
!  *
!  */
! 
! #if defined(WIN32)
! 
! #pragma warning (disable: 4244)
! #pragma warning (disable: 4101)
! 
! #define scumm_stricmp stricmp
! 
! 
! #if defined(CHECK_HEAP)
! #undef CHECK_HEAP
! #define CHECK_HEAP checkHeap();
! #else
! #define CHECK_HEAP
! #endif
! 
! #define SCUMM_LITTLE_ENDIAN
! 
! #define FORCEINLINE __forceinline
! #define NORETURN _declspec(noreturn)
! 
! typedef unsigned char byte;
! typedef unsigned char uint8;
! typedef unsigned short uint16;
! typedef unsigned long uint32;
! typedef unsigned int uint;
! typedef signed char int8;
! typedef signed short int16;
! typedef signed long int32;
! 
! #define START_PACK_STRUCTS pack (push,1)
! #define END_PACK_STRUCTS   pack(pop)
! 
! #elif defined(UNIX)
! 
! #define scumm_stricmp strcasecmp
! 
! #define CHECK_HEAP
! 
! /* need this for the SDL_BYTEORDER define */
! #include <SDL_byteorder.h>
! 
! #if SDL_BYTEORDER == SDL_LIL_ENDIAN
! #define SCUMM_LITTLE_ENDIAN
! #elif SDL_BYTEORDER == SDL_BIG_ENDIAN
! #define SCUMM_BIG_ENDIAN
! #define SCUMM_NEED_ALIGNMENT
! #else
! #error Neither SDL_BIG_ENDIAN nor SDL_LITTLE_ENDIAN is set.
! #endif
! 
! #define FORCEINLINE inline
! #define NORETURN 
! #define CDECL 
! 
! typedef unsigned char byte;
! typedef unsigned char uint8;
! typedef unsigned short uint16;
! typedef unsigned long uint32;
! typedef unsigned int uint;
! typedef signed char int8;
! typedef signed short int16;
! typedef signed long int32;
! 
! #define START_PACK_STRUCTS pack (1)
! #define END_PACK_STRUCTS   pack ()
! 
! #else
! #error No system type defined
! #endif
! 
! 
! #if defined(SCUMM_LITTLE_ENDIAN)
! 
! #if defined(SCUMM_NEED_ALIGNMENT)
! #error Little endian processors that need alignment is not implemented
! #endif
! 
! #define MKID(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000))
! 
! int FORCEINLINE READ_LE_UINT16(void *ptr) {
! 	return *(uint16*)(ptr);
! }
! 
! int FORCEINLINE READ_BE_UINT16(void *ptr) {
! 	return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1];
! }
! 
! uint32 FORCEINLINE READ_LE_UINT32(void *ptr) {
! 	return *(uint32*)(ptr);
! }
! 
! uint32 FORCEINLINE READ_BE_UINT32(void *ptr) {
! 	byte *b = (byte*)ptr;
! 	return (b[0]<<24)+(b[1]<<16)+(b[2]<<8)+(b[3]);
! }
! 
! #define READ_BE_UINT32_UNALIGNED READ_BE_UINT32
! #define READ_BE_UINT16_UNALIGNED READ_BE_UINT16
! 
! #define READ_UINT32_UNALIGNED(a) (*((uint32*)a))
! 
! #define FROM_LE_32(__a__) __a__
! #define FROM_LE_16(__a__) __a__
! 
! #define TO_LE_32(__a__) __a__
! #define TO_LE_16(__a__) __a__
! 
! #define TO_BE_32(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000))
! 
! #elif defined(SCUMM_BIG_ENDIAN)
! 
! #define MKID(a) (a)
! 
! uint32 FORCEINLINE FROM_LE_32(uint32 a) {
! 	return ((a>>24)&0xFF) + ((a>>8)&0xFF00) + ((a<<8)&0xFF0000) + ((a<<24)&0xFF000000);
! }
! 
! uint16 FORCEINLINE FROM_LE_16(uint16 a) {
! 	return ((a>>8)&0xFF) + ((a<<8)&0xFF00);
! }
! 
! #define TO_LE_32 FROM_LE_32
! #define TO_LE_16 FROM_LE_16
! 
! uint32 FORCEINLINE READ_LE_UINT32(void *ptr) {
! 	byte *b = (byte*)ptr;
! 	return (b[3]<<24)+(b[2]<<16)+(b[1]<<8)+(b[0]);
! }
! 
! uint32 FORCEINLINE READ_BE_UINT32(void *ptr) {
! 	return *(uint32*)(ptr);
! }
! 
! int FORCEINLINE READ_LE_UINT16(void *ptr) {
! 	byte *b = (byte*)ptr;
! 	return (b[1]<<8) + b[0];
! }
! 
! int FORCEINLINE READ_BE_UINT16(void *ptr) {
! 	return *(uint16*)(ptr);
! }
! 
! int FORCEINLINE READ_BE_UINT16_UNALIGNED(void *ptr) {
! 	return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1];
! }
! 
! uint32 FORCEINLINE READ_BE_UINT32_UNALIGNED(void *ptr) {
! 	byte *b = (byte*)ptr;
! 	return (b[0]<<24)+(b[1]<<16)+(b[2]<<8)+(b[3]);
! }
! 
! #define READ_UINT32_UNALIGNED READ_BE_UINT32_UNALIGNED
! 
! #define TO_BE_32(a) (a)
! 
! #else
! 
! #error No endianness defined
! 
! #endif
! 
--- 1,226 ----
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * $Header$
!  *
!  */
! 
! #if defined(_MSC_VER)
! 
! #pragma warning (disable: 4244)
! #pragma warning (disable: 4101)
! 
! #define scumm_stricmp stricmp
! 
! #if defined(CHECK_HEAP)
! #undef CHECK_HEAP
! #define CHECK_HEAP checkHeap();
! #else
! #define CHECK_HEAP
! #endif
! 
! #define SCUMM_LITTLE_ENDIAN
! 
! #define FORCEINLINE __forceinline
! #define NORETURN _declspec(noreturn)
! 
! typedef unsigned char byte;
! typedef unsigned char uint8;
! typedef unsigned short uint16;
! typedef unsigned long uint32;
! typedef unsigned int uint;
! typedef signed char int8;
! typedef signed short int16;
! typedef signed long int32;
! 
! #define START_PACK_STRUCTS pack (push,1)
! #define END_PACK_STRUCTS   pack(pop)
! #define GCC_PACK
! 
! #elif defined(__CYGWIN__)
! 
! #define scumm_stricmp stricmp
! #define CHECK_HEAP
! #define SCUMM_LITTLE_ENDIAN
! 
! #define FORCEINLINE inline
! #define NORETURN __attribute__((__noreturn__))
! #define GCC_PACK __attribute__((packed))
! #define CDECL
! 
! typedef unsigned char byte;
! typedef unsigned char uint8;
! typedef unsigned short uint16;
! typedef unsigned long uint32;
! typedef unsigned int uint;
! typedef signed char int8;
! typedef signed short int16;
! typedef signed long int32;
! 
! #define START_PACK_STRUCTS pack (push,1)
! #define END_PACK_STRUCTS   pack(pop)
! 
! #elif (defined(UNIX) || defined(__APPLE__))
! 
! #define scumm_stricmp strcasecmp
! 
! #define CHECK_HEAP
! 
! /* need this for the SDL_BYTEORDER define */
! #include <SDL_byteorder.h>
! 
! #if SDL_BYTEORDER == SDL_LIL_ENDIAN
! #define SCUMM_LITTLE_ENDIAN
! #elif SDL_BYTEORDER == SDL_BIG_ENDIAN
! #define SCUMM_BIG_ENDIAN
! #define SCUMM_NEED_ALIGNMENT
! #else
! #error Neither SDL_BIG_ENDIAN nor SDL_LITTLE_ENDIAN is set.
! #endif
! 
! #define FORCEINLINE inline
! #define CDECL 
! 
! typedef unsigned char byte;
! typedef unsigned char uint8;
! typedef unsigned short uint16;
! typedef unsigned long uint32;
! typedef unsigned int uint;
! typedef signed char int8;
! typedef signed short int16;
! typedef signed long int32;
! 
! #if defined(__GNUC__)
! #define START_PACK_STRUCTS
! #define END_PACK_STRUCTS
! #define GCC_PACK __attribute__((packed))
! #define NORETURN __attribute__((__noreturn__)) 
! #else
! #define START_PACK_STRUCTS pack (1)
! #define END_PACK_STRUCTS   pack ()
! #define GCC_PACK
! #define NORETURN
! #endif
! 
! #else
! #error No system type defined
! #endif
! 
! 
! #if defined(SCUMM_LITTLE_ENDIAN)
! 
! //#if defined(SCUMM_NEED_ALIGNMENT)
! //#error Little endian processors that need alignment is not implemented
! //#endif
! 
! #define MKID(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000))
! 
! #if defined(SCUMM_NEED_ALIGNMENT)
! 	uint FORCEINLINE READ_LE_UINT16(void *ptr) {
! 		return (((byte*)ptr)[1]<<8)|((byte*)ptr)[0];
! 	}
! #else
! 	uint FORCEINLINE READ_LE_UINT16(void *ptr) {
! 		return *(uint16*)(ptr);
! 	}
! #endif
! 
! uint FORCEINLINE READ_BE_UINT16(void *ptr) {
! 	return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1];
! }
! 
! #if defined(SCUMM_NEED_ALIGNMENT)
! 	uint32 FORCEINLINE READ_LE_UINT32(void *ptr) {
! 		byte *b = (byte*)ptr;
! 		return (b[3]<<24)+(b[2]<<16)+(b[1]<<8)+(b[0]);
! 	}
! #else
! 	uint32 FORCEINLINE READ_LE_UINT32(void *ptr) {
! 		return *(uint32*)(ptr);
! 	}
! #endif
! 
! uint32 FORCEINLINE READ_BE_UINT32(void *ptr) {
! 	byte *b = (byte*)ptr;
! 	return (b[0]<<24)+(b[1]<<16)+(b[2]<<8)+(b[3]);
! }
! 
! #define READ_BE_UINT32_UNALIGNED READ_BE_UINT32
! #define READ_BE_UINT16_UNALIGNED READ_BE_UINT16
! 
! #define READ_UINT32_UNALIGNED(a) READ_LE_UINT32(a)
! 
! #define FROM_LE_32(__a__) __a__
! #define FROM_LE_16(__a__) __a__
! 
! #define TO_LE_32(__a__) __a__
! #define TO_LE_16(__a__) __a__
! 
! #define TO_BE_32(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000))
! 
! #elif defined(SCUMM_BIG_ENDIAN)
! 
! #define MKID(a) (a)
! 
! uint32 FORCEINLINE FROM_LE_32(uint32 a) {
! 	return ((a>>24)&0xFF) + ((a>>8)&0xFF00) + ((a<<8)&0xFF0000) + ((a<<24)&0xFF000000);
! }
! 
! uint16 FORCEINLINE FROM_LE_16(uint16 a) {
! 	return ((a>>8)&0xFF) + ((a<<8)&0xFF00);
! }
! 
! #define TO_LE_32 FROM_LE_32
! #define TO_LE_16 FROM_LE_16
! 
! uint32 FORCEINLINE READ_LE_UINT32(void *ptr) {
! 	byte *b = (byte*)ptr;
! 	return (b[3]<<24)+(b[2]<<16)+(b[1]<<8)+(b[0]);
! }
! 
! uint32 FORCEINLINE READ_BE_UINT32(void *ptr) {
! 	return *(uint32*)(ptr);
! }
! 
! uint FORCEINLINE READ_LE_UINT16(void *ptr) {
! 	byte *b = (byte*)ptr;
! 	return (b[1]<<8) + b[0];
! }
! 
! uint FORCEINLINE READ_BE_UINT16(void *ptr) {
! 	return *(uint16*)(ptr);
! }
! 
! uint FORCEINLINE READ_BE_UINT16_UNALIGNED(void *ptr) {
! 	return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1];
! }
! 
! uint32 FORCEINLINE READ_BE_UINT32_UNALIGNED(void *ptr) {
! 	byte *b = (byte*)ptr;
! 	return (b[0]<<24)+(b[1]<<16)+(b[2]<<8)+(b[3]);
! }
! 
! #define READ_UINT32_UNALIGNED READ_BE_UINT32_UNALIGNED
! 
! #define TO_BE_32(a) (a)
! 
! #else
! 
! #error No endianness defined
! 
! #endif
! 

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C2 -d -r1.6.2.1 -r1.6.2.2
*** scummvm.cpp	2001/11/12 16:12:53	1.6.2.1
--- scummvm.cpp	2001/12/20 00:18:03	1.6.2.2
***************
*** 1,1052 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...2085 lines suppressed...]
! 	va_list va;
! 
! 	if (level>5)
! 		return;
! 
! 	va_start(va,s);
! 	vsprintf(buf, s, va);
! 	va_end(va);
! 	printf("%s\n", buf);
! 	fflush(stdout);
! }
! 
! void checkHeap() {
! #if defined(WIN32)
! 	if (_heapchk() != _HEAPOK) {
! 		error("Heap is invalid!");
! 	}
! #endif
! }
! 

Index: scummvm.dsp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.dsp,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** scummvm.dsp	2001/11/12 16:20:34	1.2.2.1
--- scummvm.dsp	2001/12/20 00:18:03	1.2.2.2
***************
*** 51,55 ****
  LINK32=link.exe
  # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib sdl.lib /nologo /subsystem:console /machine:I386
  
  !ELSEIF  "$(CFG)" == "scummvm - Win32 Debug"
--- 51,55 ----
  LINK32=link.exe
  # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib sdl.lib winmm.lib /nologo /subsystem:console /machine:I386
  
  !ELSEIF  "$(CFG)" == "scummvm - Win32 Debug"
***************
*** 67,71 ****
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
! # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "d:\sdl\sdl-1.2.2\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DUMP_SCRIPTS" /Fr /Yu"stdafx.h" /FD /GZ /c
  # ADD BASE RSC /l 0x41d /d "_DEBUG"
  # ADD RSC /l 0x41d /d "_DEBUG"
--- 67,72 ----
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
! # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "./sound" /I "./" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "ALLOW_GDI" /D "BYPASS_COPY_PROT" /D "USE_ADLIB" /D "DUMP_SCRIPTS" /D "FULL_THROTTLE" /D "CHECK_HEAP" /Yu"stdafx.h" /FD /GZ /c
! # SUBTRACT CPP /Fr
  # ADD BASE RSC /l 0x41d /d "_DEBUG"
  # ADD RSC /l 0x41d /d "_DEBUG"
***************
*** 75,79 ****
  LINK32=link.exe
  # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib sdl.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
  
  !ENDIF 
--- 76,80 ----
  LINK32=link.exe
  # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib sdl.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
  
  !ENDIF 
***************
*** 86,105 ****
  
  # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
! # Begin Source File
! 
! SOURCE=.\actor.cpp
  
! !IF  "$(CFG)" == "scummvm - Win32 Release"
  
! # ADD CPP /Gd
  
! !ELSEIF  "$(CFG)" == "scummvm - Win32 Debug"
  
! !ENDIF 
  
  # End Source File
  # Begin Source File
  
! SOURCE=.\boxes.cpp
  
  !IF  "$(CFG)" == "scummvm - Win32 Release"
--- 87,113 ----
  
  # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
! # Begin Group "sound"
  
! # PROP Default_Filter ""
! # Begin Source File
  
! SOURCE=.\sound\adlib.cpp
! # End Source File
! # Begin Source File
  
! SOURCE=.\sound\fmopl.cpp
! # End Source File
! # Begin Source File
  
! SOURCE=.\sound\gmidi.cpp
! # End Source File
! # Begin Source File
  
+ SOURCE=.\sound\imuse.cpp
  # End Source File
+ # End Group
  # Begin Source File
  
! SOURCE=.\actor.cpp
  
  !IF  "$(CFG)" == "scummvm - Win32 Release"
***************
*** 114,119 ****
  # Begin Source File
  
! SOURCE=.\costume.cpp
  
  !IF  "$(CFG)" == "scummvm - Win32 Release"
  
--- 122,131 ----
  # Begin Source File
  
! SOURCE=.\akos.cpp
! # End Source File
! # Begin Source File
  
+ SOURCE=.\boxes.cpp
+ 
  !IF  "$(CFG)" == "scummvm - Win32 Release"
  
***************
*** 127,130 ****
--- 139,146 ----
  # Begin Source File
  
+ SOURCE=.\costume.cpp
+ # End Source File
+ # Begin Source File
+ 
  SOURCE=.\debug.cpp
  
***************
*** 153,156 ****
--- 169,176 ----
  # Begin Source File
  
+ SOURCE=.\gui.cpp
+ # End Source File
+ # Begin Source File
+ 
  SOURCE=.\object.cpp
  
***************
*** 231,238 ****
  # Begin Source File
  
- SOURCE=.\script_v7.cpp
- # End Source File
- # Begin Source File
- 
  SOURCE=.\scummvm.cpp
  
--- 251,254 ----
***************
*** 323,326 ****
--- 339,350 ----
  # Begin Source File
  
+ SOURCE=.\sound\fmopl.h
+ # End Source File
+ # Begin Source File
+ 
+ SOURCE=.\gui.h
+ # End Source File
+ # Begin Source File
+ 
  SOURCE=.\scumm.h
  # End Source File
***************
*** 328,331 ****
--- 352,359 ----
  
  SOURCE=.\scummsys.h
+ # End Source File
+ # Begin Source File
+ 
+ SOURCE=.\sound.h
  # End Source File
  # Begin Source File

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -C2 -d -r1.7.2.2 -r1.7.2.3
*** sdl.cpp	2001/11/12 16:20:52	1.7.2.2
--- sdl.cpp	2001/12/20 00:18:03	1.7.2.3
***************
*** 1,371 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * Change Log:
!  * $Log$
!  * Revision 1.7.2.2  2001/11/12 16:20:52  yazoo
!  * The dig and Full Throttle support
!  *
!  * Revision 1.12  2001/10/26 17:34:50  strigeus
!  * bug fixes, code cleanup
!  *
!  * Revision 1.11  2001/10/23 19:51:50  strigeus
!  * recompile not needed when switching games
!  * debugger skeleton implemented
!  *
!  * Revision 1.10  2001/10/17 11:30:19  strigeus
!  * *** empty log message ***
!  *
!  * Revision 1.9  2001/10/16 20:31:27  strigeus
!  * misc fixes
!  *
!  * Revision 1.8  2001/10/16 10:01:48  strigeus
!  * preliminary DOTT support
!  *
!  * Revision 1.7  2001/10/11 11:49:51  strigeus
!  * Determine caption from file name.
!  *
!  * Revision 1.6  2001/10/11 10:15:58  strigeus
!  * no SDL cursor
!  *
!  * Revision 1.5  2001/10/10 11:53:39  strigeus
!  * smoother mouse + bug fix
!  *
!  * Revision 1.4  2001/10/10 10:02:33  strigeus
!  * alternative mouse cursor
!  * basic save&load
!  *
!  * Revision 1.3  2001/10/09 19:02:28  strigeus
!  * command line parameter support
!  *
!  * Revision 1.2  2001/10/09 17:38:20  strigeus
!  * Autodetection of endianness.
!  *
!  * Revision 1.1.1.1  2001/10/09 14:30:13  strigeus
!  * initial revision
!  *
!  */
! 
! #define NEED_SDL_HEADERS
! 
! #include "stdafx.h"
! #include "scumm.h"
! 
! #define SCALEUP_2x2
! 
! Scumm scumm;
! ScummDebugger debugger;
! 
! static SDL_Surface *screen;
! 
! void updatePalette(Scumm *s) {
! 	SDL_Color colors[256];
! 	int first = s->_palDirtyMin;
! 	int num = s->_palDirtyMax - first + 1;
! 	int i;
! 	byte *data = s->_currentPalette;
! 
! 	data += first*3;
! 	for (i=0; i<num; i++,data+=3) {
! 		colors[i].r = data[0]<<2;
! 		colors[i].g = data[1]<<2;
! 		colors[i].b = data[2]<<2;
! 		colors[i].unused = 0;
! 	}
! 	
! 	SDL_SetColors(screen, colors, first, num);
! 	
! 	s->_palDirtyMax = -1;
! 	s->_palDirtyMin = 0x3E8;
! }
! 
! void waitForTimer(Scumm *s) {
! 	SDL_Event event;
! 	byte dontPause = true;
! 	
! 	do {
! 		while (SDL_PollEvent(&event)) {
! 			switch(event.type) {
! 			case SDL_KEYDOWN:
! 				s->_keyPressed = event.key.keysym.sym;
! 				if (event.key.keysym.sym >= '0' && event.key.keysym.sym<='9') {
! 					s->_saveLoadSlot = event.key.keysym.sym - '0';
! 					if (event.key.keysym.mod&KMOD_SHIFT)
! 						s->_saveLoadFlag = 1;
! 					else if (event.key.keysym.mod&KMOD_CTRL)
! 						s->_saveLoadFlag = 2;
! 					s->_saveLoadCompatible = false;
! 				}
! 				if (event.key.keysym.sym=='z' && event.key.keysym.mod&KMOD_CTRL) {
! 					exit(1);
! 				}
! 				if (event.key.keysym.sym=='f' && event.key.keysym.mod&KMOD_CTRL) {
! 					s->_fastMode ^= 1;
! 				}
! 				if (event.key.keysym.sym=='d' && event.key.keysym.mod&KMOD_CTRL) {
! 					debugger.attach(s);
! 				}
! 				
! 				break;
! 			case SDL_MOUSEMOTION: {
! 				int newx,newy;
! #if !defined(SCALEUP_2x2)
! 				newx = event.motion.x;
! 				newy = event.motion.y;
! #else
! 				newx = event.motion.x>>1;
! 				newy = event.motion.y>>1;
! #endif
! 				if (newx != s->mouse.x || newy != s->mouse.y) {
! 					s->mouse.x = newx;
! 					s->mouse.y = newy;
! 					s->drawMouse();
! 					updateScreen(s);
! 				}
! 				break;
! 				}
! 			case SDL_MOUSEBUTTONDOWN:
! 				if (event.button.button==SDL_BUTTON_LEFT)
! 					s->_leftBtnPressed |= 1;
! 				else if (event.button.button==SDL_BUTTON_RIGHT)
! 					s->_rightBtnPressed |= 1;
! 				break;
! #if 0
! 			case SDL_ACTIVEEVENT:
! 				if (event.active.state & SDL_APPINPUTFOCUS) {
! 					dontPause = event.active.gain;
! 				}
! 				break;
! #endif
! 			case SDL_QUIT:
! 				exit(1);
! 				break;
! 			}
! 		}
! 		SDL_Delay(dontPause ? 10 : 100);
! 	} while (!dontPause);
! 
! 	s->_scummTimer+=3;
! }
! 
! #define MAX_DIRTY_RECTS 40
! SDL_Rect dirtyRects[MAX_DIRTY_RECTS];
! int numDirtyRects;
! bool fullRedraw;
! 
! int old_mouse_x, old_mouse_y;
! bool has_mouse,hide_mouse;
! byte old_backup[24*16*2];
! 
! 
! void addDirtyRect(int x, int y, int w, int h) {
! 	SDL_Rect *r;
! 	if (numDirtyRects==MAX_DIRTY_RECTS)
! 		fullRedraw = true;
! 	else if (!fullRedraw) {
! 		r = &dirtyRects[numDirtyRects++];
! 		r->x = x*2;
! 		r->y = y*2;
! 		r->w = w*2;
! 		r->h = h*2;
! 	}
! }
! 
! void addDirtyRectClipped(int x, int y, int w, int h) {
! 	if (x<0) { w += x; x=0; }
! 	if (y<0) { h += y; y=0; }
! 	if (w >= 320-x) w = 320-x;
! 	if (h >= 200-y) h = 200-y;
! 	if (w>0 && h>0)
! 		addDirtyRect(x,y,w,h);
! }
! 
! /* Copy part of bitmap */
! void blitToScreen(Scumm *s, byte *src,int x, int y, int w, int h) {
! 	byte *dst;
! 	int i;
! 
! 	hide_mouse = true;
! 	if (has_mouse) {
! 		s->drawMouse();
! 	}
! 
! 	if (SDL_LockSurface(screen)==-1)
! 		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
! 
! #if !defined(SCALEUP_2x2)
! 	dst = (byte*)screen->pixels + y*320 + x;
! 	addDirtyRect(x,y,w,h);
! 	do {
! 		memcpy(dst, src, w);
! 		dst += 640;
! 		src += 320;
! 	} while (--h);
! #else
! 	dst = (byte*)screen->pixels + y*640*2 + x*2;
! 	addDirtyRect(x,y,w,h);		
! 	do {
! 		i=0;
! 		do {
! 			dst[i*2] = dst[i*2+1] = src[i];
! 		} while (++i!=w);
! 		memcpy(dst+640, dst, w*2);
! 		dst += 640*2;
! 		src += 320;
! 	} while (--h);
! 
! #endif
! 
! 	SDL_UnlockSurface(screen);
! }
! 
! void updateScreen(Scumm *s) {
! 	
! 	if (hide_mouse) {
! 		hide_mouse = false;
! 		s->drawMouse();
! 	}
! 	
! 	if(s->_palDirtyMax != -1) {
! 		updatePalette(s);
! 	}
! 	if (fullRedraw) {
! 		SDL_UpdateRect(screen, 0,0,0,0);
! #if defined(SHOW_AREA)
! 		debug(2,"update area 100 %%");
! #endif
! 	} else if (numDirtyRects) {
! #if defined(SHOW_AREA)
! 		int area = 0,i;
! 		for (i=0; i<numDirtyRects; i++)
! 			area += (dirtyRects[i].w * dirtyRects[i].h);
! 		debug(2,"update area %f %%", (float)area/640);
! #endif
! 		SDL_UpdateRects(screen, numDirtyRects, dirtyRects);	
! 	}
! 
! 	numDirtyRects = 0;
! }
! 
! void drawMouse(Scumm *s, int xdraw, int ydraw, int color, byte *mask, bool visible) {
! 	int x,y;
! 	uint32 bits;
! 	byte *dst,*bak;
! 
! 	if (hide_mouse)
! 		visible = false;
! 
! 	if (SDL_LockSurface(screen)==-1)
! 		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
! 
! 	if (has_mouse) {
! 		dst = (byte*)screen->pixels + old_mouse_y*640*2 + old_mouse_x*2;
! 		bak = old_backup;
! 
! 		for (y=0; y<16; y++,bak+=48,dst+=640*2) {
! 			if ( (uint)(old_mouse_y + y) < 200) {
! 				for (x=0; x<24; x++) {
! 					if ((uint)(old_mouse_x + x) < 320) {
! 						dst[x*2+640] = dst[x*2] = bak[x*2];
! 						dst[x*2+640+1] = dst[x*2+1] = bak[x*2+1];
! 					}
! 				}
! 			}
! 		}
! 	}
! 
! 	if (visible) {
! 		dst = (byte*)screen->pixels + ydraw*640*2 + xdraw*2;
! 		bak = old_backup;
! 
! 		for (y=0; y<16; y++,dst+=640*2,bak+=48) {
! 			bits = mask[3] | (mask[2]<<8) | (mask[1]<<16);
! 			mask += 4;
! 			if ((uint)(ydraw+y)<200) {
! 				for (x=0; x<24; x++,bits<<=1) {
! 					if ((uint)(xdraw+x)<320) {
! 						bak[x*2] = dst[x*2];
! 						bak[x*2+1] = dst[x*2+1];
! 						if (bits&(1<<23)) {
! 							dst[x*2] = color;
! 							dst[x*2+1] = color;
! 							dst[x*2+640] = color;
! 							dst[x*2+1+640] = color;
! 						}
! 					}
! 				}
! 			}
! 		}
! 	}
! 
! 	SDL_UnlockSurface(screen);
! 
! 	if (has_mouse) {
! 		has_mouse = false;
! 		addDirtyRectClipped(old_mouse_x, old_mouse_y, 24, 16);
! 	}
! 
! 	if (visible) {
! 		has_mouse = true;
! 		addDirtyRectClipped(xdraw, ydraw, 24, 16);
! 		old_mouse_x = xdraw;
! 		old_mouse_y = ydraw;
! 	}
! 	
! }
! 
! void initGraphics(Scumm *s) {
! 	if (SDL_Init(SDL_INIT_VIDEO)==-1) {
! 		error("Could not initialize SDL: %s.\n", SDL_GetError());
!     exit(1);
! 	}
! 
! 	/* Clean up on exit */
!  	atexit(SDL_Quit);
! 
! 	char buf[512], *gameName;
! 	
! 	sprintf(buf, "ScummVM - %s", gameName = s->getGameName());
! 	free(gameName);
! 	
! 	SDL_WM_SetCaption(buf,buf);
! 	SDL_ShowCursor(SDL_DISABLE);
! 
! #if !defined(SCALEUP_2x2)
! 	screen = SDL_SetVideoMode(320, 200, 8, SDL_SWSURFACE);
! #else
! 	screen = SDL_SetVideoMode(640, 400, 8, SDL_SWSURFACE);
! #endif
! 
! 	printf("%d %d, %d %d, %d %d %d, %d %d %d %d %d\n", 
! 		sizeof(int8), sizeof(uint8),
! 		sizeof(int16), sizeof(uint16),
! 		sizeof(int32), sizeof(uint32),
! 		sizeof(void*),
! 		sizeof(Box), sizeof(MouseCursor),sizeof(CodeHeader),
! 		sizeof(ImageHeader),
! 		sizeof(Scumm)
! 	);
! }
! 
! #undef main
! int main(int argc, char* argv[]) {
! 	scumm._videoMode = 0x13;
! 	scumm.scummMain(argc, argv);
! 	return 0;
! }
! 
--- 1,494 ----
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * $Header$
!  *
!  */
! 
! #define NEED_SDL_HEADERS
! 
! #include "stdafx.h"
! #include "scumm.h"
! #include "gui.h"
! #include "sound.h"
! 
! #include "SDL_thread.h"
! 
! #define SCALEUP_2x2
! 
! Scumm scumm;
! ScummDebugger debugger;
! Gui gui;
! 
! SoundEngine sound;
! SOUND_DRIVER_TYPE snd_driv;
! 
! static SDL_Surface *screen;
! 
! void updateScreen(Scumm *s);
! 
! void updatePalette(Scumm *s) {
! 	SDL_Color colors[256];
! 	int first = s->_palDirtyMin;
! 	int num = s->_palDirtyMax - first + 1;
! 	int i;
! 	byte *data = s->_currentPalette;
! 
! 	data += first*3;
! 	for (i=0; i<num; i++,data+=3) {
! 		colors[i].r = data[0];
! 		colors[i].g = data[1];
! 		colors[i].b = data[2];
! 		colors[i].unused = 0;
! 	}
! 	
! 	SDL_SetColors(screen, colors, first, num);
! 	
! 	s->_palDirtyMax = -1;
! 	s->_palDirtyMin = 0x3E8;
! }
! 
! int mapKey(int key, byte mod) {
! 	if (key>=SDLK_F1 && key<=SDLK_F9) {
! 		return key - SDLK_F1 + 315;
! 	} else if (key>='a' && key<='z' && mod&KMOD_SHIFT) {
! 		key&=~0x20;
! 	} else if (key>=SDLK_NUMLOCK && key<=SDLK_EURO)
! 		return 0;
! 	return key;
! }
! 
! void waitForTimer(Scumm *s, int msec_delay) {
! 	SDL_Event event;
! 	uint32 start_time;
! 
! 	if (s->_fastMode&2)
! 		msec_delay = 0;
! 	else if (s->_fastMode&1)
! 		msec_delay = 10;
! 
! 	start_time = SDL_GetTicks();
! 
! 	do {
! 		while (SDL_PollEvent(&event)) {
! 			switch(event.type) {
! 			case SDL_KEYDOWN:
! 				s->_keyPressed = mapKey(event.key.keysym.sym, event.key.keysym.mod);
! 				if (event.key.keysym.sym >= '0' && event.key.keysym.sym<='9') {
! 					s->_saveLoadSlot = event.key.keysym.sym - '0';
! 					if (event.key.keysym.mod&KMOD_SHIFT) {
! 						sprintf(s->_saveLoadName, "Quicksave %d", s->_saveLoadSlot);
! 						s->_saveLoadFlag = 1;
! 					} else if (event.key.keysym.mod&KMOD_CTRL)
! 						s->_saveLoadFlag = 2;
! 					s->_saveLoadCompatible = false;
! 				}
! 				if (event.key.keysym.sym=='z' && event.key.keysym.mod&KMOD_CTRL) {
! 					exit(1);
! 				} 
! 				if (event.key.keysym.sym=='f' && event.key.keysym.mod&KMOD_CTRL) {
! 					s->_fastMode ^= 1;
! 				}
! 				if (event.key.keysym.sym=='g' && event.key.keysym.mod&KMOD_CTRL) {
! 					s->_fastMode ^= 2;
! 				}
! 
! 				if (event.key.keysym.sym=='d' && event.key.keysym.mod&KMOD_CTRL) {
! 					debugger.attach(s);
! 				}
! 				if (event.key.keysym.sym=='s' && event.key.keysym.mod&KMOD_CTRL) {
! 					s->resourceStats();
! 				}
! 
! 	#if defined(__APPLE__)
! 				if (event.key.keysym.sym=='q' && event.key.keysym.mod&KMOD_LMETA) {
! 					exit(1);
! 				} 
! 	#endif
! 				break;
! 			case SDL_MOUSEMOTION: {
! 				int newx,newy;
! 	#if !defined(SCALEUP_2x2)
! 				newx = event.motion.x;
! 				newy = event.motion.y;
! 	#else
! 				newx = event.motion.x>>1;
! 				newy = event.motion.y>>1;
! 	#endif
! 				if (newx != s->mouse.x || newy != s->mouse.y) {
! 					s->mouse.x = newx;
! 					s->mouse.y = newy;
! 					s->drawMouse();
! 					updateScreen(s);
! 				}
! 				break;
! 				}
! 			case SDL_MOUSEBUTTONDOWN:
! 				if (event.button.button==SDL_BUTTON_LEFT)
! 					s->_leftBtnPressed |= msClicked|msDown;
! 				else if (event.button.button==SDL_BUTTON_RIGHT)
! 					s->_rightBtnPressed |= msClicked|msDown;
! 				break;
! 			case SDL_MOUSEBUTTONUP:
! 				if (event.button.button==SDL_BUTTON_LEFT)
! 					s->_leftBtnPressed &= ~msDown;
! 				else if (event.button.button==SDL_BUTTON_RIGHT)
! 					s->_rightBtnPressed &= ~msDown;
! 				break;
! 
! 			case SDL_QUIT:
! 				exit(1);
! 				break;
! 			}
! 		}
! 
! 		if (SDL_GetTicks() >= start_time + msec_delay)
! 			break;
! 		SDL_Delay(10);
! 	} while (1);
! }
! 
! #define MAX_DIRTY_RECTS 40
! SDL_Rect dirtyRects[MAX_DIRTY_RECTS];
! int numDirtyRects;
! bool fullRedraw;
! 
! int old_mouse_x, old_mouse_y;
! int old_mouse_h, old_mouse_w;
! bool has_mouse,hide_mouse;
! 
! #define BAK_WIDTH 40
! #define BAK_HEIGHT 40
! byte old_backup[BAK_WIDTH*BAK_HEIGHT*2];
! 
! 
! void addDirtyRect(int x, int y, int w, int h) {
! 	SDL_Rect *r;
! 	if (numDirtyRects==MAX_DIRTY_RECTS)
! 		fullRedraw = true;
! 	else if (!fullRedraw) {
! 		r = &dirtyRects[numDirtyRects++];
! #if defined(SCALEUP_2x2)
! 		r->x = x*2;
! 		r->y = y*2;
! 		r->w = w*2;
! 		r->h = h*2;
! #else
! 		r->x = x;
! 		r->y = y;
! 		r->w = w;
! 		r->h = h;
! #endif
! 	}
! }
! 
! void addDirtyRectClipped(int x, int y, int w, int h) {
! 	if (x<0) { w += x; x=0; }
! 	if (y<0) { h += y; y=0; }
! 	if (w >= 320-x) w = 320-x;
! 	if (h >= 200-y) h = 200-y;
! 	if (w>0 && h>0)
! 		addDirtyRect(x,y,w,h);
! }
! 
! /* Copy part of bitmap */
! void blitToScreen(Scumm *s, byte *src,int x, int y, int w, int h) {
! 	byte *dst;
! 	int i;
! 
! 	hide_mouse = true;
! 	if (has_mouse) {
! 		s->drawMouse();
! 	}
! 
! 	if (SDL_LockSurface(screen)==-1)
! 		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
! 
! #if !defined(SCALEUP_2x2)
! 	dst = (byte*)screen->pixels + y*320 + x;
! 	addDirtyRect(x,y,w,h);
! 	do {
! 		memcpy(dst, src, w);
! 		dst += 320;
! 		src += 320;
! 	} while (--h);
! #else
! 	dst = (byte*)screen->pixels + y*640*2 + x*2;
! 	addDirtyRect(x,y,w,h);		
! 	do {
! 		i=0;
! 		do {
! 			dst[i*2] = dst[i*2+1] = src[i];
! 		} while (++i!=w);
! 		memcpy(dst+640, dst, w*2);
! 		dst += 640*2;
! 		src += 320;
! 	} while (--h);
! 
! #endif
! 
! 	SDL_UnlockSurface(screen);
! }
! 
! void updateScreen(Scumm *s) {
! 
! 	if (s->_fastMode&2)
! 		return;
! 
! 	if (hide_mouse) {
! 		hide_mouse = false;
! 		s->drawMouse();
! 	}
! 	
! 	if(s->_palDirtyMax != -1) {
! 		updatePalette(s);
! 	}
! 	if (fullRedraw) {
! 		SDL_UpdateRect(screen, 0,0,0,0);
! 		fullRedraw = false;
! #if defined(SHOW_AREA)
! 		debug(2,"update area 100 %%");
! #endif
! 	} else if (numDirtyRects) {
! #if defined(SHOW_AREA)
! 		int area = 0,i;
! 		for (i=0; i<numDirtyRects; i++)
! 			area += (dirtyRects[i].w * dirtyRects[i].h);
! 		debug(2,"update area %f %%", (float)area/640);
! #endif
! 
! 		SDL_UpdateRects(screen, numDirtyRects, dirtyRects);	
! 	}
! 
! 	numDirtyRects = 0;
! }
! 
! void drawMouse(Scumm *s, int xdraw, int ydraw, int w, int h, byte *buf, bool visible) {
! 	int x,y;
! 	byte *dst,*bak;
! 	byte color;
! 
! 	if (hide_mouse)
! 		visible = false;
! 
! 	assert(w<=BAK_WIDTH && h<=BAK_HEIGHT);
! 
! 	if (SDL_LockSurface(screen)==-1)
! 		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
! 
! #if defined(SCALEUP_2x2)
! 
! 	if (has_mouse) {
! 		dst = (byte*)screen->pixels + old_mouse_y*640*2 + old_mouse_x*2;
! 		bak = old_backup;
! 
! 		for (y=0; y<old_mouse_h; y++,bak+=BAK_WIDTH*2,dst+=640*2) {
! 			if ( (uint)(old_mouse_y + y) < 200) {
! 				for (x=0; x<old_mouse_w; x++) {
! 					if ((uint)(old_mouse_x + x) < 320) {
! 						dst[x*2+640] = dst[x*2] = bak[x*2];
! 						dst[x*2+640+1] = dst[x*2+1] = bak[x*2+1];
! 					}
! 				}
! 			}
! 		}
! 	}
! 
! 	if (visible) {
! 		dst = (byte*)screen->pixels + ydraw*640*2 + xdraw*2;
! 		bak = old_backup;
! 
! 		for (y=0; y<h; y++,dst+=640*2,bak+=BAK_WIDTH*2,buf+=w) {
! 			if ((uint)(ydraw+y)<200) {
! 				for (x=0; x<w; x++) {
! 					if ((uint)(xdraw+x)<320) {
! 						bak[x*2] = dst[x*2];
! 						bak[x*2+1] = dst[x*2+1];
! 						if ((color=buf[x])!=0xFF) {
! 							dst[x*2] = color;
! 							dst[x*2+1] = color;
! 							dst[x*2+640] = color;
! 							dst[x*2+1+640] = color;
! 						}
! 					}
! 				}
! 			}
! 		}
! 	}
! #else
! 	if (has_mouse) {
! 		dst = (byte*)screen->pixels + old_mouse_y*320 + old_mouse_x;
! 		bak = old_backup;
! 
! 		for (y=0; y<old_mouse_h; y++,bak+=BAK_WIDTH,dst+=320) {
! 			if ( (uint)(old_mouse_y + y) < 200) {
! 				for (x=0; x<old_mouse_w; x++) {
! 					if ((uint)(old_mouse_x + x) < 320) {
! 						dst[x] = bak[x];
! 					}
! 				}
! 			}
! 		}
! 	}
! 	if (visible) {
! 		dst = (byte*)screen->pixels + ydraw*320 + xdraw;
! 		bak = old_backup;
! 
! 		for (y=0; y<h; y++,dst+=320,bak+=BAK_WIDTH,buf+=w) {
! 			if ((uint)(ydraw+y)<200) {
! 				for (x=0; x<w; x++) {
! 					if ((uint)(xdraw+x)<320) {
! 						bak[x] = dst[x];
! 						if ((color=buf[x])!=0xFF) {
! 							dst[x] = color;
! 						}
! 					}
! 				}
! 			}
! 		}
! 	}
! 
! 
! #endif	
! 
! 	SDL_UnlockSurface(screen);
! 
! 	if (has_mouse) {
! 		has_mouse = false;
! 		addDirtyRectClipped(old_mouse_x, old_mouse_y, old_mouse_w, old_mouse_h);
! 	}
! 
! 	if (visible) {
! 		has_mouse = true;
! 		addDirtyRectClipped(xdraw, ydraw, w, h);
! 		old_mouse_x = xdraw;
! 		old_mouse_y = ydraw;
! 		old_mouse_w = w;
! 		old_mouse_h = h;
! 	}
! }
! 
! static uint32 midi_counter;
! 
! void fill_sound(void *userdata, Uint8 *stream, int len) {
! 	scumm.mixWaves((int16*)stream, len>>1);
! }
! 
! int music_thread(Scumm *s) {
! 	int old_time, cur_time;
! 
! 	old_time = SDL_GetTicks();
! 
! 	do {
! 		SDL_Delay(10);
! 		
! 		cur_time = SDL_GetTicks();
! 		while (old_time < cur_time) {
! 			old_time += 10;
! 			sound.on_timer();	
! 		}
! 	} while (1);
! 	
! 	return 0;
! }
! 
! 
! void initGraphics(Scumm *s, bool fullScreen) {
! 	SDL_AudioSpec desired;
! 
! 	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)==-1) {
! 		error("Could not initialize SDL: %s.\n", SDL_GetError());
! 	    exit(1);
! 	}
! 
! 	/* Clean up on exit */
!  	atexit(SDL_Quit);
! 
! 	char buf[512], *gameName;
! 	
! 	sprintf(buf, "ScummVM - %s", gameName = s->getGameName());
! 	free(gameName);
! 
! 	desired.freq = SAMPLES_PER_SEC;
! 	desired.format = AUDIO_S16SYS;
! 	desired.channels = 1;
! 	desired.samples = 2048;
! 	desired.callback = fill_sound;
! 	SDL_OpenAudio(&desired, NULL);
! 	SDL_PauseAudio(0);
! 
! 	SDL_WM_SetCaption(buf,buf);
! 	SDL_ShowCursor(SDL_DISABLE);
! 
! 	if (!snd_driv.wave_based()) {
! 		/* Create Music Thread */
! 		SDL_CreateThread((int (*)(void *))&music_thread, &scumm);
! 	}
! 
! #if !defined(SCALEUP_2x2)
! 	screen = SDL_SetVideoMode(320, 200, 8, fullScreen ? (SDL_SWSURFACE | SDL_FULLSCREEN) : SDL_SWSURFACE);
! #else
! 	screen = SDL_SetVideoMode(640, 400, 8, fullScreen ? (SDL_SWSURFACE | SDL_FULLSCREEN) : SDL_SWSURFACE);
! #endif
! 
! 	printf("%d %d, %d %d, %d %d %d, %d %d %d %d %d\n", 
! 		sizeof(int8), sizeof(uint8),
! 		sizeof(int16), sizeof(uint16),
! 		sizeof(int32), sizeof(uint32),
! 		sizeof(void*),
! 		sizeof(Box), sizeof(MouseCursor),sizeof(CodeHeader),
! 		sizeof(ImageHeader),
! 		sizeof(Scumm)
! 	);
! }
! 
! 
! #if !defined(__APPLE__)
! #undef main
! #endif
! 
! int main(int argc, char* argv[]) {
! 	int delta,tmp;
! 	int last_time, new_time;
! 
! 	sound.initialize(&scumm, &snd_driv);
! 
! 	scumm._gui = &gui;
! 	scumm.scummMain(argc, argv);
! 
! 	gui.init(&scumm);
! 
! 	last_time = SDL_GetTicks();
! 	delta = 0;
! 	do {
! 		updateScreen(&scumm);
! 
! 		new_time = SDL_GetTicks();
! 		waitForTimer(&scumm, delta * 15 + last_time - new_time);
! 		last_time = SDL_GetTicks();
! 
! 		if (gui._active) {
! 			gui.loop();
! 			delta = 5;
! 		} else {
! 			delta = scumm.scummLoop(delta);
! 		}
! 	} while(1);
! 
! 	return 0;
! }
! 

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -C2 -d -r1.1.1.1.2.1 -r1.1.1.1.2.2
*** sound.cpp	2001/11/12 16:21:12	1.1.1.1.2.1
--- sound.cpp	2001/12/20 00:18:03	1.1.1.1.2.2
***************
*** 1,112 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * Change Log:
!  * $Log$
!  * Revision 1.1.1.1.2.1  2001/11/12 16:21:12  yazoo
!  * The dig and Full Throttle support
!  *
!  * Revision 1.2  2001/10/16 10:01:48  strigeus
!  * preliminary DOTT support
!  *
!  * Revision 1.1.1.1  2001/10/09 14:30:13  strigeus
!  *
!  * initial revision
!  *
!  *
!  */
! 
! #include "stdafx.h"
! #include "scumm.h"
! 
! void Scumm::addSoundToQueue(int sound) {
! 	_vars[VAR_LAST_SOUND] = sound;
! 	ensureResourceLoaded(4, sound);
! 	addSoundToQueue2(sound);
! }
! 
! void Scumm::addSoundToQueue2(int sound) {
! 	if (_soundQue2Pos < 10) {
! 		_soundQue2[_soundQue2Pos++] = sound;
! 	}
! }
! 
! void Scumm::unkSoundProc22() {
! 	byte d;
! 	int i,j;
! 	int num;
! 	int16 data[16];
! 
! 	while (_soundQue2Pos){
! 		d=_soundQue2[--_soundQue2Pos];
! 		if (d)
! 			playSound(d);
! 	}
! 
! #if 0
! 	for (i=0; i<_soundQuePos; ) {
! 		num = _soundQue[i++];
! 		for (j=0; j<16; j++)
! 			data[j] = 0;
! 		if (num>0) {
! 			for (j=0; j<num; j++)
! 				_soundQue[i+j] = data[j];
! 			i += num;
! 			/* XXX: not implemented */
! 			warning("unkSoundProc22: not implemented");
! //			vm.vars[VAR_SOUNDRESULT] = soundProcPtr1(...);
! 		}
! 	}
! 	#endif
! 	_soundQuePos = 0;
! }
! 
! void Scumm::playSound(int sound) {
! 	getResourceAddress(4, sound);
! 	/* XXX: not implemented */
! //	warning("stub playSound(%d)", sound);
! }
! 
! int Scumm::unkSoundProc23(int a) {
! 	/* TODO: implement this */
! //	warning("unkSoundProc23: not implemented");
! 	return 0;
! }
! 
! void Scumm::unkSoundProc1(int a) {
! 	/* TODO: implement this */
! //	warning("unkSoundProc: not implemented");
! }
! 
! void Scumm::soundKludge(int16 *list) {
! 	int16 *ptr;
! 	int i;
! 
! 	if (list[0]==-1) {
! 		unkSoundProc22();
! 		return;
! 	}
! 	_soundQue[_soundQuePos++] = 8;
! 
! 	ptr = _soundQue + _soundQuePos;
! 	_soundQuePos += 8;
! 
! 	for (i=0; i<8; i++)
! 		*ptr++ = list[i];
! 	if (_soundQuePos > 0x100)
! 		error("Sound que buffer overflow");
! }
\ No newline at end of file
--- 1,479 ----
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * $Header$
!  *
!  */
! 
! #include "stdafx.h"
! #include "scumm.h"
! #include "sound.h"
! 
! void Scumm::addSoundToQueue(int sound) {
! #if !defined(FULL_THROTTLE)
! 	_vars[VAR_LAST_SOUND] = sound;
! 	ensureResourceLoaded(rtSound, sound);
! 	addSoundToQueue2(sound);
! #endif
! }
! 
! void Scumm::addSoundToQueue2(int sound) {
! 	if (_soundQue2Pos < 10) {
! 		_soundQue2[_soundQue2Pos++] = sound;
! 	}
! }
! 
! void Scumm::processSoundQues() {
! 	byte d;
! 	int i,j;
! 	int num;
! 	int16 data[16];
! 	SoundEngine *se;
! 
! 	processSfxQueues();
! 
! 	while (_soundQue2Pos){
! 		d=_soundQue2[--_soundQue2Pos];
! 		if (d)
! 			playSound(d);
! 	}
! 
! 	for (i=0; i<_soundQuePos; ) {
! 		num = _soundQue[i++];
! 		if (i + num > _soundQuePos) {
! 			warning("processSoundQues: invalid num value");
! 			break;
! 		}
! 		for (j=0; j<16; j++)
! 			data[j] = 0;
! 		if (num>0) {
! 			for (j=0; j<num; j++)
! 				data[j] = _soundQue[i+j];
! 			i += num;
! 
! 			se = (SoundEngine*)_soundEngine;
! #if 0
! 			debug(1,"processSoundQues(%d,%d,%d,%d,%d,%d,%d,%d,%d)", 
! 				data[0]>>8,
! 				data[0]&0xFF,
! 				data[1],
! 				data[2],
! 				data[3],
! 				data[4],
! 				data[5],
! 				data[6],
! 				data[7]
! 				);
! #endif
! #if !defined(FULL_THROTTLE)
! 			if (se) 
! 				_vars[VAR_SOUNDRESULT] = se->do_command(data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7]);
! #endif
! 		}
! 	}
! 	_soundQuePos = 0;
! }
! 
! void Scumm::playSound(int sound) {
! 	SoundEngine *se = (SoundEngine*)_soundEngine;
! 	if (se) {
! 		getResourceAddress(rtSound, sound);
! 		se->start_sound(sound);
! 	}
! }
! 
! void Scumm::processSfxQueues() {
! 	Actor *a;
! 	int act;
! 	bool b,finished;
! 
! 	if (_talk_sound_mode != 0) {
! 		startTalkSound(_talk_sound_a, _talk_sound_b, _talk_sound_mode);
! 		_talk_sound_mode = 0;
! 	}
! 	
! 	if (_sfxMode==2) {
! 		act = _vars[VAR_TALK_ACTOR];
! 		finished = isSfxFinished();
! 
! 		if (act!=0 && (uint)act<0x80 && !string[0].no_talk_anim) {
! 			a = derefActorSafe(act, "processSfxQueues");
! 			if (a->room==_currentRoom && (finished || !_endOfMouthSync)) {
! 				b = true;
! 				if (!finished)
! 					b = isMouthSyncOff(_curSoundPos);
! 				if (_mouthSyncMode != b) {
! 					_mouthSyncMode = b;
! 					startAnimActor(a, b ? a->talkFrame2 : a->talkFrame1);
! 				}
! 			}
! 		}
! 		if (finished && _talkDelay==0) {
! 			stopTalk();
! 			_sfxMode = 0;
! 		}
! 	} else if (_sfxMode==1) {
! 		if (isSfxFinished()) {
! 			_sfxMode = 0;
! 		}
! 	}
! }
! 
! void Scumm::startTalkSound(uint32 offset, uint32 b, int mode) {
! 	int num, i;
! 	byte file_byte,file_byte_2;
! 	uint16 elem;
! 
! 	if (!_sfxFile) {
! 		warning("startTalkSound: SFX file is not open");
! 		return;
! 	}
! 
! 	fileSeek((FILE*)_sfxFile, offset + 8, SEEK_SET);
! 	i = 0;
! 	if (b>8) {
! 		num = (b-8)>>1;
! 		do {
! 			fileRead((FILE*)_sfxFile, &file_byte, sizeof(file_byte));
! 			fileRead((FILE*)_sfxFile, &file_byte_2, sizeof(file_byte_2));
! 			_mouthSyncTimes[i++] = file_byte | (file_byte_2<<8);
! 		} while (--num);
! 	}
! 	_mouthSyncTimes[i] = 0xFFFF;
! 	_sfxMode = mode;
! 	_curSoundPos = 0;
! 	_mouthSyncMode = true;
! 
! 	startSfxSound(_sfxFile);
! }
! 
! void Scumm::stopTalkSound() {
! 	if (_sfxMode==2) {
! 		stopSfxSound();
! 		_sfxMode = 0;
! 	}
! }
! 
! bool Scumm::isMouthSyncOff(uint pos) {
! 	uint j;
! 	bool val = true;
! 	uint16 *ms = _mouthSyncTimes;
! 
! 	_endOfMouthSync = false;
! 	do {
! 		val ^= 1;
! 		j = *ms++;
! 		if (j==0xFFFF) {
! 			_endOfMouthSync = true;
! 			break;
! 		}
! 	} while (pos > j);
! 	return val;
! }
! 
! 
! int Scumm::isSoundRunning(int sound) {
! 	SoundEngine *se;
! 	int i;
! 
! 	i = _soundQue2Pos;
! 	while (i--) {
! 		if (_soundQue2[i] == sound)
! 			return 1;
! 	}
! 
! 	if (isSoundInQueue(sound))
! 		return 1;
! 
! 	if (!isResourceLoaded(rtSound, sound))
! 		return 0;
! 	
! 	se = (SoundEngine*)_soundEngine;
! 	if (!se)
! 		return 0;
! 	return se->get_sound_status(sound);
! }
! 
! bool Scumm::isSoundInQueue(int sound) {
! 	int i = 0,j, num;
! 	int16 table[16];
! 
! 	while (i < _soundQuePos) {
! 		num = _soundQue[i++];
! 
! 		memset(table, 0, sizeof(table));
! 
! 		if (num > 0) {
! 			for (j=0; j<num; j++)
! 				table[j] = _soundQue[i+j];
! 			i += num;
! 			if (table[0] == 0x10F && table[1]==8 && table[2] == sound)
! 				return 1;
! 		}
! 	}
! 	return 0;
! }
! 
! void Scumm::stopSound(int a) {
! 	SoundEngine *se;
! 	int i;
! 
! 	se = (SoundEngine*)_soundEngine;
! 	if (se)
! 		se->stop_sound(a);
! 
! 	for (i=0; i<10; i++)
! 		if (_soundQue2[i] == (byte)a)
! 			_soundQue2[i] = 0;
! }
! 
! void Scumm::stopAllSounds() {
! 	SoundEngine *se = (SoundEngine*)_soundEngine;
! 	if (se) {
! 		se->stop_all_sounds();
! 		se->clear_queue();
! 	}
! 	clearSoundQue();
! 	stopSfxSound();
! }
! 
! void Scumm::clearSoundQue() {
! 	_soundQue2Pos = 0;
! 	memset(_soundQue2, 0, sizeof(_soundQue2));
! }
! 
! void Scumm::soundKludge(int16 *list) {
! 	int16 *ptr;
! 	int i;
! 
! 	if (list[0]==-1) {
! 		processSoundQues();
! 		return;
! 	}
! 	_soundQue[_soundQuePos++] = 8;
! 
! 	ptr = _soundQue + _soundQuePos;
! 	_soundQuePos += 8;
! 
! 	for (i=0; i<8; i++)
! 		*ptr++ = list[i];
! 	if (_soundQuePos > 0x100)
! 		error("Sound que buffer overflow");
! }
! 
! void Scumm::talkSound(uint32 a, uint32 b, int mode) {
! 	_talk_sound_a = a;
! 	_talk_sound_b = b;
! 	_talk_sound_mode = mode;
! }
! 
! /* The sound code currently only supports General Midi.
!  * General Midi is used in Day Of The Tentacle.
!  * Roland music is also playable, but doesn't sound well.
!  * A mapping between roland instruments and GM instruments
!  * is needed.
!  */
!    
! void Scumm::setupSound() {
! 	SoundEngine *se = (SoundEngine*)_soundEngine;
! 	if (se)
! 		se->setBase(res.address[rtSound]);
! 
! 	_sfxFile = openSfxFile();
! }
! 
! void Scumm::pauseSounds(bool pause) {
! 	SoundEngine *se = (SoundEngine*)_soundEngine;
! 	if (se)
! 		se->pause(pause);
! 	_soundsPaused = pause;
! }
! 
! #pragma START_PACK_STRUCTS
! struct VOCHeader {
! 	byte id[19];
! 	byte extra[7];
! } GCC_PACK;
! #pragma END_PACK_STRUCTS 
! 
! static const char VALID_VOC_ID[] = "Creative Voice File";
! 
! void Scumm::startSfxSound(void *file) {
! 	VOCHeader hdr;
! 	int block_type;
! 	byte work[8];
! 	uint size,i;
! 	int rate,comp;
! 	byte *data;
! 
! 	/* Full throttle audio fix HERE */
! 
! 	if (fread(&hdr, sizeof(hdr), 1, (FILE*)file) != 1 || 
! 		memcmp(hdr.id, VALID_VOC_ID, sizeof(hdr.id)) != 0) {
! 		warning("startSfxSound: invalid header");
! 		return;
! 	}
! 
! 	block_type = getc( (FILE*)file );
! 	if (block_type != 1) {
! 		warning("startSfxSound: Expecting block_type == 1, got %d", block_type);
! 		return;
! 	}
! 
! 	fread(work, 3, 1, (FILE*)file);
! 
! 	size = ( work[0] | ( work[1] << 8 ) | ( work[2] << 16 ) ) - 2;
! 	rate = getc( (FILE*)file );
! 	comp = getc( (FILE*)file );
! 
! 	if (comp != 0) {
! 		warning("startSfxSound: Unsupported compression type %d", comp);
! 		return;
! 	}
! 
! 	data = (byte*) malloc(size);
! 	if (data==NULL) {
! 		error("startSfxSound: out of memory");
! 		return;
! 	}
! 	
! 	if (fread(data, size, 1, (FILE*)file) != 1) {
! 		/* no need to free the memory since error will shut down */
! 		error("startSfxSound: cannot read %d bytes", size);
! 		return;
! 	}
! 	for(i=0;i<size; i++)
! 		data[i] ^= 0x80;
! 
! 	playSfxSound(data, size, 1000000 / (256 - rate) );
! }
! 
! void *Scumm::openSfxFile() {
! 	char buf[50];
! 	FILE *file;
! 
! 	/* Try opening the file <_exe_name>.sou first, eg tentacle.sou.
! 	 * That way, you can keep .sou files for multiple games in the
! 	 * same directory */
! 
! 	sprintf(buf, "%s.sou", _exe_name);
! 	file = fopen(buf, "rb");
! 	if (!file)
! 		file = fopen("monster.sou", "rb");
! 	return file;
! }
! 
! #define NUM_MIXER 4
! 
! MixerChannel *Scumm::allocateMixer() {
! 	int i;
! 	MixerChannel *mc = _mixer_channel;
! 	for(i=0; i<NUM_MIXER; i++,mc++) {
! 		if (!mc->_sfx_sound)
! 			return mc;
! 	}
! 	return NULL;
! }
! 
! void Scumm::stopSfxSound() {
! 	MixerChannel *mc = _mixer_channel;
! 	int i;
! 	for(i=0; i<NUM_MIXER; i++,mc++) {
! 		if (mc->_sfx_sound)
! 			mc->clear();
! 	}
! }
! 
! 
! bool Scumm::isSfxFinished() {
! 	int i;
! 	for(i=0; i<NUM_MIXER; i++)
! 		if (_mixer_channel[i]._sfx_sound)
! 			return false;
! 	return true;
! }
! 
! void Scumm::playSfxSound(void *sound, uint32 size, uint rate) {
! 	MixerChannel *mc = allocateMixer();
! 
! 	if (!mc) {
! 		warning("No mixer channel available");
! 		return;
! 	}
! 
! 	mc->_sfx_sound = sound;
! 	mc->_sfx_pos = 0;
! 	mc->_sfx_fp_speed = (1<<16) * rate / 22050;
! 	mc->_sfx_fp_pos = 0;
! 
! 	while (size&0xFFFF0000) size>>=1, rate>>=1;
! 	mc->_sfx_size = size * 22050 / rate;
! }
! 
! void MixerChannel::mix(int16 *data, uint32 len) {
! 	int8 *s;
! 	int i;
! 	uint32 fp_pos, fp_speed;
! 
! 	if (!_sfx_sound)
! 		return;
! 	if (len > _sfx_size)
! 		len = _sfx_size;
! 	_sfx_size -= len;
! 
! 	s = (int8*)_sfx_sound + _sfx_pos;
! 	fp_pos = _sfx_fp_pos;
! 	fp_speed = _sfx_fp_speed;
! 
! 	do {
! 		fp_pos += fp_speed;
! 		*data++ += (*s<<6);
! 		s += fp_pos >> 16;
! 		fp_pos &= 0x0000FFFF;
! 	} while (--len);
! 
! 	_sfx_pos = s - (int8*)_sfx_sound;
! 	_sfx_fp_speed = fp_speed;
! 	_sfx_fp_pos = fp_pos;
! 
! 	if (!_sfx_size)
! 		clear();
! }
! 
! void MixerChannel::clear() {
! 	free(_sfx_sound);
! 	_sfx_sound = NULL;
! }
! 
! void Scumm::mixWaves(int16 *sounds, int len) {
! 	int i;
! 
! 	memset(sounds, 0,len * sizeof(int16));
! 
! 	if (_soundsPaused)
! 		return;
! 	
! 	SoundEngine *se = (SoundEngine*)_soundEngine;
! 	if (se) {
! 		se->driver()->generate_samples(sounds, len);
! 	}
! 	
! 	for(i=NUM_MIXER-1; i>=0;i--) {
! 		_mixer_channel[i].mix(sounds, len);
! 	}
! }
! 

Index: stdafx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/stdafx.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -C2 -d -r1.1.1.1 -r1.1.1.1.2.1
*** stdafx.cpp	2001/10/09 14:30:13	1.1.1.1
--- stdafx.cpp	2001/12/20 00:18:03	1.1.1.1.2.1
***************
*** 1,8 ****
! // stdafx.cpp : source file that includes just the standard includes
! //	scummvm.pch will be the pre-compiled header
! //	stdafx.obj will contain the pre-compiled type information
! 
! #include "stdafx.h"
! 
! // TODO: reference any additional headers you need in STDAFX.H
! // and not in this file
--- 1,8 ----
! // stdafx.cpp : source file that includes just the standard includes
! //	scummvm.pch will be the pre-compiled header
! //	stdafx.obj will contain the pre-compiled type information
! 
! #include "stdafx.h"
! 
! // TODO: reference any additional headers you need in STDAFX.H
! // and not in this file

Index: stdafx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/stdafx.h,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -d -r1.3.2.1 -r1.3.2.2
*** stdafx.h	2001/10/12 07:26:05	1.3.2.1
--- stdafx.h	2001/12/20 00:18:03	1.3.2.2
***************
*** 1,60 ****
! #if defined(WIN32)
! #include<stdio.h>
! #if _MSC_VER > 1000
! #pragma once
! #endif // _MSC_VER > 1000
! 
! #define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
! #define NOGDICAPMASKS
! #define OEMRESOURCE
! #define NONLS
! #define NOICONS
! #define NOMCX
! #define NOPROFILER
! #define NOKANJI
! #define NOSERVICE
! #define NOMETAFILE
! #define NOCOMM
! #define NOCRYPT
! #define NOIME
! #define NOATOM
! #define NOCTLMGR
! #define NOCLIPBOARD
! #define NOMEMMGR
! #define NOSYSMETRICS
! #define NOMENUS
! #define NOOPENFILE
! #define NOWH
! #define NOSOUND
! #define NODRAWTEXT
! 
! #include <SDL.h>
! #include <windows.h>
! #include <stdio.h>
! #include <stdlib.h>
! #include <string.h>
! #include <io.h>
! #include <stdarg.h>
! #include <fcntl.h>
! #include <conio.h>
! #include <malloc.h>
! #include <assert.h>
! 
! #else
! 
! #if defined(NEED_SDL_HEADERS)
! #include <SDL.h>
! #endif
! #include <sys/types.h>
! #include <sys/uio.h>
! #include <unistd.h>
! #include <stdio.h>
! #include <fcntl.h>
! #include <stdlib.h>
! #include <string.h>
! #include <stdarg.h>
! #include <assert.h>
! #include <ctype.h>
! 
! 
! #endif
--- 1,90 ----
! /*
!  * $Id$
!  *
!  * $Log$
!  * Revision 1.3.2.2  2001/12/20 00:18:03  yazoo
!  * Resync with main branch, major FT fixes
!  *
!  * Revision 1.8  2001/11/20 07:13:01  vasyl
!  * Added ability for ports to override all includes in stdafx.h. To use this feature
!  * port must define symbol NONSTANDARD_PORT. Port must also provide
!  * port-specific portdefs.h with all includes, symbol defines and everything else
!  * port needs.
!  *
!  * Revision 1.7  2001/11/11 16:54:45  strigeus
!  * implemented some sam&max specific features,
!  * fixed some bugs
!  *
!  * Revision 1.6  2001/11/06 22:59:59  cmatsuoka
!  * Re-added changes to allow cygwin and beos cross-compilation.
!  *
!  */
! 
! #if defined(NONSTANDARD_PORT)
! 
! #include <portdefs.h>
! 
! #elif defined(WIN32)
! 
! #if _MSC_VER > 1000
! #pragma once
! #endif // _MSC_VER > 1000
! 
! #define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
! #define NOGDICAPMASKS
! #define OEMRESOURCE
! #define NONLS
! #define NOICONS
! #define NOMCX
! #define NOPROFILER
! #define NOKANJI
! #define NOSERVICE
! #define NOMETAFILE
! #define NOCOMM
! #define NOCRYPT
! #define NOIME
! #define NOATOM
! #define NOCTLMGR
! #define NOCLIPBOARD
! #define NOMEMMGR
! #define NOSYSMETRICS
! #define NOMENUS
! #define NOOPENFILE
! #define NOWH
! #define NOSOUND
! #define NODRAWTEXT
! 
! #include <SDL.h>
! #include <windows.h>
! #include <stdio.h>
! #include <stdlib.h>
! #include <string.h>
! #include <io.h>
! #include <stdarg.h>
! #include <fcntl.h>
! #include <conio.h>
! #include <malloc.h>
! #include <assert.h>
! #include <mmsystem.h>
! #include <ctype.h>
! 
! #else
! 
! #if defined(NEED_SDL_HEADERS)
! #include <SDL.h>
! #endif
! #include <sys/types.h>
! #include <sys/uio.h>
! #if !defined (__BEOS__)
! #include <unistd.h>
! #endif
! #include <stdio.h>
! #include <fcntl.h>
! #include <stdlib.h>
! #include <string.h>
! #include <stdarg.h>
! #include <assert.h>
! #include <ctype.h>
! 
! 
! #endif

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/string.cpp,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.3
diff -C2 -d -r1.1.1.1.2.2 -r1.1.1.1.2.3
*** string.cpp	2001/11/12 16:22:40	1.1.1.1.2.2
--- string.cpp	2001/12/20 00:18:03	1.1.1.1.2.3
***************
*** 1,805 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
[...1588 lines suppressed...]
! 					mask[maskpos] |= maskmask;
! 				}
! 				*dst = _colorMap[color];
! 			}
! 			dst++;
! 			bits <<= _bpp;
! 			if ((numbits -= _bpp)==0) {
! 				bits = *_charPtr++;
! 				numbits = 8;
! 			}
! 			if ((maskmask>>=1)==0) {
! 				maskmask = 0x80;
! 				maskpos++;
! 			}
! 		}
! 		dst = (_dest_ptr += 320);
! 		mask += 40;
! 		y++;
! 	}
! }

Index: sys.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sys.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** sys.cpp	2001/10/10 10:02:33	1.2
--- sys.cpp	2001/12/20 00:18:03	1.2.2.1
***************
*** 1,172 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * Change Log:
!  * $Log$
!  * Revision 1.2  2001/10/10 10:02:33  strigeus
!  * alternative mouse cursor
!  * basic save&load
!  *
!  * Revision 1.1.1.1  2001/10/09 14:30:13  strigeus
!  *
!  * initial revision
!  *
!  *
!  */
! 
! #include "stdafx.h"
! #include "scumm.h"
! 
! void *Scumm::fileOpen(const char *filename, int mode) {
! 	_fileMode = mode;
! 	_whereInResToRead = 0;	
! 	clearFileReadFailed(_fileHandle);
! 
! 	if (mode==1)
! 		return fopen(filename, "rb");
! 	
! 	if (mode==2) {
! 		error("fileOpen: write not supported");
! 	}
! 	
! 	return NULL;
! }
! 
! void Scumm::fileClose(void *file) {
! 	if (_fileMode==1 || _fileMode==2)
! 		fclose((FILE*)file);
! }
! 
! bool Scumm::fileReadFailed(void *file) {
! 	return _fileReadFailed != 0;
! }
! 
! void Scumm::clearFileReadFailed(void *file) {
! 	_fileReadFailed = false;
! }
! 
! bool Scumm::fileEof(void *file) {
! 	FILE *a = (FILE*)file;
! 	return feof((FILE*)file) != 0;
! }
! 
! void Scumm::fileSeek(void *file, long offs, int whence) {
! 	switch(_fileMode) {
! 	case 1: case 2:
! 		fseek((FILE*)file, offs, whence);
! 		return;
! 	case 3:
! 		_whereInResToRead = offs;
! 		return;
! 	}
! }
! 
! void Scumm::fileRead(void *file, void *ptr, uint32 size) {
! 	byte *ptr2 = (byte*)ptr, *src;
! 
! 	switch(_fileMode) {
! 	case 1:
! 		if (size==0)
! 			return;
! 
! 		if ((uint32)fread(ptr2, size, 1, (FILE*)file) != 1)
! 			_fileReadFailed = true;
! 
! 		do {
! 			*ptr2++	^= _encbyte;
! 		} while(--size);
! 
! 		return;
! 
! 	case 3:
! 		if (size==0)
! 			return;
! 
! 		src = getResourceAddress(0xC, 3) + _whereInResToRead;
! 		_whereInResToRead += size;
! 		do {
! 			*ptr2++ = *src++ ^ _encbyte;
! 		} while (--size);
! 		return;
! 	}
! }
! 
! int Scumm::fileReadByte() {
! 	byte b;
! 	byte *src;
! 
! 	switch(_fileMode) {
! 	case 1:
! 		if (fread(&b,1,1,(FILE*)_fileHandle) != 1)
! 			_fileReadFailed = true;
! 		return b ^ _encbyte;
! 
! 	case 3:
! 		src = getResourceAddress(0xC, 3) + _whereInResToRead;
! 		_whereInResToRead++;
! 		return *src ^ _encbyte;
! 	}
! 	return 0;
! }
! 
! uint Scumm::fileReadWordLE() {
! 	uint a = fileReadByte();
! 	uint b = fileReadByte();
! 	return a|(b<<8);
! }
! 
! uint32 Scumm::fileReadDwordLE() {
! 	uint a = fileReadWordLE();
! 	uint b = fileReadWordLE();
! 	return (b<<16)|a;
! }
! 
! uint Scumm::fileReadWordBE() {
! 	uint b = fileReadByte();
! 	uint a = fileReadByte();
! 	return a|(b<<8);
! }
! 
! uint32 Scumm::fileReadDwordBE() {
! 	uint b = fileReadWordBE();
! 	uint a = fileReadWordBE();
! 	return (b<<16)|a;
! }
! 
! byte *Scumm::alloc(int size) {
! 	byte *me = (byte*)::calloc(size+4,1);
! 	if (me==NULL)
! 		return NULL;
! 
! 	*((uint32*)me) = 0xDEADBEEF;
! 	return me + 4;
! }
! 
! void Scumm::free(void *mem) {
! 	byte *me = (byte*)mem - 4;
! 	if ( *((uint32*)me) != 0xDEADBEEF) {
! 		error("Freeing invalid block.");
! 	}
! 
! 	*((uint32*)me) = 0xC007CAFE;
! 	::free(me);
! }
! 
! bool Scumm::checkFixedDisk() {
! 	return true;
! }
! 
--- 1,169 ----
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * $Header$
!  *
!  */
! 
! #include "stdafx.h"
! #include "scumm.h"
! 
! void *Scumm::fileOpen(const char *filename, int mode) {
! 	_fileMode = mode;
! 	_whereInResToRead = 0;	
! 	clearFileReadFailed(_fileHandle);
! 
! 	if (mode==1)
! 		return fopen(filename, "rb");
! 	
! 	if (mode==2) {
! 		error("fileOpen: write not supported");
! 	}
! 	
! 	return NULL;
! }
! 
! void Scumm::fileClose(void *file) {
! 	if (_fileMode==1 || _fileMode==2)
! 		fclose((FILE*)file);
! }
! 
! bool Scumm::fileReadFailed(void *file) {
! 	return _fileReadFailed != 0;
! }
! 
! void Scumm::clearFileReadFailed(void *file) {
! 	_fileReadFailed = false;
! }
! 
! bool Scumm::fileEof(void *file) {
! 	FILE *a = (FILE*)file;
! 	return feof((FILE*)file) != 0;
! }
! 
! uint32 Scumm::filePos(void *handle) {
! 	return ftell((FILE*)handle);
! }
! 
! void Scumm::fileSeek(void *file, long offs, int whence) {
! 	switch(_fileMode) {
! 	case 1: case 2:
! 		fseek((FILE*)file, offs, whence);
! 		return;
! 	case 3:
! 		_whereInResToRead = offs;
! 		return;
! 	}
! }
! 
! void Scumm::fileRead(void *file, void *ptr, uint32 size) {
! 	byte *ptr2 = (byte*)ptr, *src;
! 
! 	switch(_fileMode) {
! 	case 1:
! 		if (size==0)
! 			return;
! 
! 		if ((uint32)fread(ptr2, size, 1, (FILE*)file) != 1)
! 			_fileReadFailed = true;
! 
! 		do {
! 			*ptr2++	^= _encbyte;
! 		} while(--size);
! 
! 		return;
! 
! 	case 3:
! 		if (size==0)
! 			return;
! 
! 		src = getResourceAddress(rtTemp, 3) + _whereInResToRead;
! 		_whereInResToRead += size;
! 		do {
! 			*ptr2++ = *src++ ^ _encbyte;
! 		} while (--size);
! 		return;
! 	}
! }
! 
! int Scumm::fileReadByte() {
! 	byte b;
! 	byte *src;
! 
! 	switch(_fileMode) {
! 	case 1:
! 		if (fread(&b,1,1,(FILE*)_fileHandle) != 1)
! 			_fileReadFailed = true;
! 		return b ^ _encbyte;
! 
! 	case 3:
! 		src = getResourceAddress(rtTemp, 3) + _whereInResToRead;
! 		_whereInResToRead++;
! 		return *src ^ _encbyte;
! 	}
! 	return 0;
! }
! 
! uint Scumm::fileReadWordLE() {
! 	uint a = fileReadByte();
! 	uint b = fileReadByte();
! 	return a|(b<<8);
! }
! 
! uint32 Scumm::fileReadDwordLE() {
! 	uint a = fileReadWordLE();
! 	uint b = fileReadWordLE();
! 	return (b<<16)|a;
! }
! 
! uint Scumm::fileReadWordBE() {
! 	uint b = fileReadByte();
! 	uint a = fileReadByte();
! 	return a|(b<<8);
! }
! 
! uint32 Scumm::fileReadDwordBE() {
! 	uint b = fileReadWordBE();
! 	uint a = fileReadWordBE();
! 	return (b<<16)|a;
! }
! 
! byte *Scumm::alloc(int size) {
! 	byte *me = (byte*)::calloc(size+4,1);
! 	if (me==NULL)
! 		return NULL;
! 
! 	*((uint32*)me) = 0xDEADBEEF;
! 	return me + 4;
! }
! 
! void Scumm::free(void *mem) {
! 	if (mem) {
! 		byte *me = (byte*)mem - 4;
! 		if ( *((uint32*)me) != 0xDEADBEEF) {
! 			error("Freeing invalid block.");
! 		}
! 
! 		*((uint32*)me) = 0xC007CAFE;
! 		::free(me);
! 	}
! }
! 
! bool Scumm::checkFixedDisk() {
! 	return true;
! }
! 

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/verbs.cpp,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** verbs.cpp	2001/11/12 16:23:01	1.2.2.1
--- verbs.cpp	2001/12/20 00:18:03	1.2.2.2
***************
*** 1,309 ****
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * Change Log:
!  * $Log$
!  * Revision 1.2.2.1  2001/11/12 16:23:01  yazoo
!  * The dig and Full Throttle support
!  *
!  * Revision 1.4  2001/10/26 17:34:50  strigeus
!  * bug fixes, code cleanup
!  *
!  * Revision 1.3  2001/10/16 10:01:48  strigeus
!  * preliminary DOTT support
!  *
!  * Revision 1.2  2001/10/09 19:02:28  strigeus
!  * command line parameter support
!  *
!  * Revision 1.1.1.1  2001/10/09 14:30:13  strigeus
!  *
!  * initial revision
!  *
!  *
!  */
! 
! #include "stdafx.h"
! #include "scumm.h"
! 
! void Scumm::redrawVerbs() {
! 	int i;
! 	for (i=0; i<_maxVerbs; i++)
! 		drawVerb(i, 0);
! 	verbMouseOver(0);
! }
! 
! void Scumm::checkExecVerbs() {
! 	int i,over;
! 	VerbSlot *vs;
! 
! 	if (_userPut<=0 || _mouseButStat==0)
! 		return;
! 
! 	if (_mouseButStat < 0x200) {
! 		/* Check keypresses */
! 		vs = &_verbs[1];
! 		for (i=1; i<_maxVerbs; i++,vs++) {
! 			if (vs->verbid && vs->saveid && vs->curmode==1) {
! 				if (_mouseButStat == vs->key) {
! 					runInputScript(1, vs->verbid, 1);
! 					return;
! 				}
! 			}
! 		}
! 		runInputScript(4, _mouseButStat, 1);
! 	} else if (_mouseButStat&0xC000) {
! 		byte code = _mouseButStat&0x8000 ? 1 : 2;
! 		if (mouse.y >= virtscr[0].topline && mouse.y < virtscr[0].topline + virtscr[0].height) {
! 			over = checkMouseOver(mouse.x, mouse.y);
! 			if (over != 0) {
! 				runInputScript(1,_verbs[over].verbid,code);
! 				return;
! 			}
! 			runInputScript(2, 0, code);
! 		} else {
! 			over=checkMouseOver(mouse.x, mouse.y);
! 			runInputScript(1, over!=0 ? _verbs[over].verbid : 0, code);
! 		}
! 	}
! }
! 
! void Scumm::verbMouseOver(int verb) {
! 	if (_verbMouseOver==verb)
! 		return;
! 
! 	if (_verbs[_verbMouseOver].type!=1) {
! 		drawVerb(_verbMouseOver, 0);
! 		_verbMouseOver = verb;
! 	}
! 
! 	if (_verbs[verb].type!=1 && _verbs[verb].hicolor) {
! 		drawVerb(verb, 1);
! 		_verbMouseOver = verb;
! 	}
! }
! 
! int Scumm::checkMouseOver(int x, int y) {
! 	VerbSlot *vs;
! 	int i = _maxVerbs-1;
! 
! 	vs = &_verbs[i];
! 	do {
! 		if (vs->curmode!=1 || !vs->verbid || vs->saveid ||
! 				y < vs->y || y >= vs->bottom)
! 				continue;
! 		if (vs->center) {
! 			if (x < -(vs->right - vs->x - vs->x) || x >= vs->right)
! 					continue;
! 		} else {
! 			if (x < vs->x || x >= vs->right)
! 				continue;
! 		}
! 		return i;
! 	} while (--vs,--i);
! 	return 0;
! }
! 
! void Scumm::drawVerb(int vrb, int mode) {
! 	VerbSlot *vs;
! 	byte color;
! 	byte tmp;
! 
! 	if (!vrb)
! 		return;
! 
! 	vs = &_verbs[vrb];
! 
! 	if (!vs->saveid && vs->curmode && vs->verbid) {
! 		if (vs->type==1) {
! 			drawVerbBitmap(vrb, vs->x, vs->y);
! 			return;
! 		}
! 		restoreVerbBG(vrb);
! 
! 		string[4].charset = vs->charset_nr;
! 		string[4].xpos = vs->x;
! 		string[4].ypos = vs->y;
! 		string[4].right = 319;
! 		string[4].center = vs->center;
! 		if (mode && vs->hicolor)
! 			color = vs->hicolor;
! 		else
! 			color = vs->color;
! 		string[4].color = color;
! 		if (vs->curmode==2)
! 			string[4].color = vs->dimcolor;
! 		_messagePtr = getResourceAddress(8, vrb);
! 		assert(_messagePtr);
! 		tmp = charset._center;
! 		charset._center = 0;
! 		drawString(4);
! 		charset._center = tmp;
! 		vs->right = charset._strRight;
! 		vs->bottom = charset._strBottom;
! 		vs->oldleft = charset._strLeft;
! 		vs->oldright = charset._strRight;
! 		vs->oldtop = charset._strTop;
! 		vs->oldbottom = charset._strBottom;
! 		charset._strLeft = charset._strRight;
! 	} else {
! 		restoreVerbBG(vrb);
! 	}
! }
! 
! void Scumm::restoreVerbBG(int verb) {
! 	VerbSlot *vs;
! 
! 	vs = &_verbs[verb];
! 
! 	if (vs->oldleft != -1) {
! 		_bkColor = vs->bkcolor;
! 		restoreBG(vs->oldleft, vs->oldtop, vs->oldright, vs->oldbottom);
! 		vs->oldleft = -1;
! 	}
! }
! 
! void Scumm::drawVerbBitmap(int vrb, int x, int y) {
! 	int nozbufs;
! 	VirtScreen *vs;
! 	VerbSlot *vst;
! 	byte twobufs, *imptr;
! 	int ydiff, xstrip;
! 	int imgw, imgh;
! 	int i,tmp;
! 	byte *IMHD_ptr;
! 	byte *obim;
! 
! 	if ((vs=findVirtScreen(y)) == NULL)
! 		return;
! 
! 	_lastXstart = virtscr[0].xstart;
! 	
! 	gdi.disableZBuffer();
! 
! 	twobufs = vs->alloctwobuffers;
! 	vs->alloctwobuffers = 0;
! 
! 	xstrip = x>>3;
! 	ydiff = y - vs->topline;
! 
! 
! 	obim = getResourceAddress(8, vrb);
! 	IMHD_ptr = findResource(MKID('IMHD'), obim, 0);
! 
! 	imgw = READ_LE_UINT16(IMHD_ptr+0x14) >> 3;
! 	imgh = READ_LE_UINT16(IMHD_ptr+0x16) >> 3;
! 	
! 	imptr = findResource(MKID('IM01'), obim, 0);
! 	if (!imptr)
! 		error("No image for verb %d", vrb);
! 
! 	for (i=0; i<imgw; i++) {
! 		tmp = xstrip + i;
! 		if ((uint)tmp < 40)
! 			gdi.drawBitmap(imptr, vs, tmp, ydiff, imgh<<3, i, 1, true);
! 	}
! 
! 	vst = &_verbs[vrb];
! 	vst->right = vst->x + imgw*8;
! 	vst->bottom = vst->y + imgh*8;
! 	vst->oldleft = vst->x;
! 	vst->oldright = vst->right;
! 	vst->oldtop = vst->y;
! 	vst->oldbottom = vst->bottom;
! 	
! 	gdi.enableZBuffer();
! 
! 	vs->alloctwobuffers = twobufs;
! }
! 
! int Scumm::getVerbSlot(int id, int mode) {
! 	int i;
! 	for (i=1; i<_maxVerbs; i++) {
! 		if (_verbs[i].verbid == id && _verbs[i].saveid == mode) {
! 			return i;
! 		}
! 	}
! 	return 0;
! }
! 
! void Scumm::killVerb(int slot) {
! 	VerbSlot *vs;
! 
! 	if (slot==0)
! 		return;
! 
! 	vs = &_verbs[slot];
! 	vs->verbid = 0;
! 	vs->curmode = 0;
! 
! 	nukeResource(8, slot);
! 
! 	if (vs->saveid==0) {
! 		drawVerb(slot, 0);
! 		verbMouseOver(0);
! 	}
! 	vs->saveid = 0;
! }
! 
! void Scumm::setVerbObject(int room, int object, int verb) {
! 	int numobj, i;
! 	byte  *obimptr;
! 	uint32 imoffs,size;
! 	byte *roomptr;
! 	ImageHeader *imhd;
! 	RoomHeader *roomhdr;
! 	int temp;
! 
! 	if (whereIsObject(object) == 4)
! 		error("Can't grab verb image from flobject");
! 
! 	ensureResourceLoaded(1,room);
! 	roomptr = getResourceAddress(1, room);
! 	roomhdr = (RoomHeader*)findResource(MKID('RMHD'), roomptr, 0);
! 
! 	if((_majorScummVersion>=7)&&(_middleScummVersion>2))
! 		numobj = READ_LE_UINT16(&roomhdr->v7.numObjects);
! 	else
! 		numobj = READ_LE_UINT16(&roomhdr->v5.numObjects);
  
! 	if (numobj==0)
! 		error("No images found in room %d", room);
! 	if (numobj > 200)
! 		error("More (%d) than %d objects in room %d", numobj, 200, room);
! 
! 	for (i=0; i<numobj; i++) {
! 		obimptr = findResource(MKID('OBIM'), roomptr, i);
! 		if (obimptr==NULL)
! 			error("Not enough image blocks in room %d", room);
! 		imhd = (ImageHeader*)findResource(MKID('IMHD'), obimptr, 0);
! 		
! 		if((_majorScummVersion>=7)&&(_middleScummVersion>2))
! 			temp=READ_LE_UINT16(&imhd->v7.obj_id);
  		else
! 			temp=READ_LE_UINT16(&imhd->v5.obj_id);
  
! 		if ( temp == object) {
! 			imoffs = obimptr - roomptr;
! 			size = READ_BE_UINT32_UNALIGNED(obimptr+4);
! 			createResource(8, verb, size);
! 			obimptr = getResourceAddress(1, room) + imoffs;
! 			memcpy(getResourceAddress(8, verb), obimptr, size);
! 			return;
! 		}
! 	}
! 	error("Image %d not found in room %d", object, room);
! }
--- 1,257 ----
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001  Ludvig Strigeus
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
  
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * $Header$
!  *
!  */
! 
! #include "stdafx.h"
! #include "scumm.h"
! 
! void Scumm::redrawVerbs() {
! 	int i;
! 	for (i=0; i<_maxVerbs; i++)
! 		drawVerb(i, 0);
! 	verbMouseOver(0);
! }
! 
! void Scumm::checkExecVerbs() {
! 	int i,over;
! 	VerbSlot *vs;
! 
! 	if (_userPut<=0 || _mouseButStat==0)
! 		return;
! 
! 	if (_mouseButStat < MBS_MAX_KEY) {
! 		/* Check keypresses */
! 		vs = &_verbs[1];
! 		for (i=1; i<_maxVerbs; i++,vs++) {
! 			if (vs->verbid && vs->saveid==0 && vs->curmode==1) {
! 				if (_mouseButStat == vs->key) {
! 					runInputScript(1, vs->verbid, 1);
! 					return;
! 				}
! 			}
! 		}
! 		runInputScript(4, _mouseButStat, 1);
! 	} else if (_mouseButStat&MBS_MOUSE_MASK) {
! 		byte code = _mouseButStat&MBS_LEFT_CLICK ? 1 : 2;
! 		if (mouse.y >= virtscr[0].topline && mouse.y < virtscr[0].topline + virtscr[0].height) {
! 			over = checkMouseOver(mouse.x, mouse.y);
! 			if (over != 0) {
! 				runInputScript(1,_verbs[over].verbid,code);
! 				return;
! 			}
! 			runInputScript(2, 0, code);
! 		} else {
! 			over=checkMouseOver(mouse.x, mouse.y);
! 			runInputScript(1, over!=0 ? _verbs[over].verbid : 0, code);
! 		}
! 	}
! }
! 
! void Scumm::verbMouseOver(int verb) {
! 	if (_verbMouseOver==verb)
! 		return;
! 
! 	if (_verbs[_verbMouseOver].type!=1) {
! 		drawVerb(_verbMouseOver, 0);
! 		_verbMouseOver = verb;
! 	}
! 
! 	if (_verbs[verb].type!=1 && _verbs[verb].hicolor) {
! 		drawVerb(verb, 1);
! 		_verbMouseOver = verb;
! 	}
! }
! 
! int Scumm::checkMouseOver(int x, int y) {
! 	VerbSlot *vs;
! 	int i = _maxVerbs-1;
! 
! 	vs = &_verbs[i];
! 	do {
! 		if (vs->curmode!=1 || !vs->verbid || vs->saveid ||
! 				y < vs->y || y >= vs->bottom)
! 				continue;
! 		if (vs->center) {
! 			if (x < -(vs->right - vs->x - vs->x) || x >= vs->right)
! 					continue;
! 		} else {
! 			if (x < vs->x || x >= vs->right)
! 				continue;
! 		}
! 		return i;
! 	} while (--vs,--i);
! 	return 0;
! }
! 
! void Scumm::drawVerb(int vrb, int mode) {
! 	VerbSlot *vs;
! 	byte color;
! 	byte tmp;
! 
! 	if (!vrb)
! 		return;
! 
! 	vs = &_verbs[vrb];
! 
! 	if (!vs->saveid && vs->curmode && vs->verbid) {
! 		if (vs->type==1) {
! 			drawVerbBitmap(vrb, vs->x, vs->y);
! 			return;
! 		}
! 		restoreVerbBG(vrb);
! 
! 		string[4].charset = vs->charset_nr;
! 		string[4].xpos = vs->x;
! 		string[4].ypos = vs->y;
! 		string[4].right = 319;
! 		string[4].center = vs->center;
! 		if (mode && vs->hicolor)
! 			color = vs->hicolor;
  		else
! 			color = vs->color;
! 		string[4].color = color;
! 		if (vs->curmode==2)
! 			string[4].color = vs->dimcolor;
! 		_messagePtr = getResourceAddress(rtVerb, vrb);
! 		assert(_messagePtr);
! 		tmp = charset._center;
! 		charset._center = 0;
! 		drawString(4);
! 		charset._center = tmp;
! 		vs->right = charset._strRight;
! 		vs->bottom = charset._strBottom;
! 		vs->oldleft = charset._strLeft;
! 		vs->oldright = charset._strRight;
! 		vs->oldtop = charset._strTop;
! 		vs->oldbottom = charset._strBottom;
! 		charset._strLeft = charset._strRight;
! 	} else {
! 		restoreVerbBG(vrb);
! 	}
! }
  
! void Scumm::restoreVerbBG(int verb) {
! 	VerbSlot *vs;
! 
! 	vs = &_verbs[verb];
! 
! 	if (vs->oldleft != -1) {
! 		_bkColor = vs->bkcolor;
! 		restoreBG(vs->oldleft, vs->oldtop, vs->oldright, vs->oldbottom);
! 		vs->oldleft = -1;
! 	}
! }
! 
! void Scumm::drawVerbBitmap(int vrb, int x, int y) {
! 	int nozbufs;
! 	VirtScreen *vs;
! 	VerbSlot *vst;
! 	byte twobufs, *imptr;
! 	int ydiff, xstrip;
! 	int imgw, imgh;
! 	int i,tmp;
! 	byte *obim;
! 	ImageHeader *imhd;
! 
! 	if ((vs=findVirtScreen(y)) == NULL)
! 		return;
! 
! 	_lastXstart = virtscr[0].xstart;
! 	
! 	gdi.disableZBuffer();
! 
! 	twobufs = vs->alloctwobuffers;
! 	vs->alloctwobuffers = 0;
! 
! 	xstrip = x>>3;
! 	ydiff = y - vs->topline;
! 
! 	obim = getResourceAddress(rtVerb, vrb);
! 
! 	imhd = (ImageHeader*)findResourceData(MKID('IMHD'), obim);
! 	imgw = READ_LE_UINT16(&imhd->width) >> 3;
! 	imgh = READ_LE_UINT16(&imhd->height) >> 3;
! 	
! 	imptr = findResource(MKID('IM01'), obim);
! 	if (!imptr)
! 		error("No image for verb %d", vrb);
! 
! 	for (i=0; i<imgw; i++) {
! 		tmp = xstrip + i;
! 		if ((uint)tmp < 40)
! 			gdi.drawBitmap(imptr, vs, tmp, ydiff, imgh<<3, i, 1, true);
! 	}
! 
! 	vst = &_verbs[vrb];
! 	vst->right = vst->x + imgw*8;
! 	vst->bottom = vst->y + imgh*8;
! 	vst->oldleft = vst->x;
! 	vst->oldright = vst->right;
! 	vst->oldtop = vst->y;
! 	vst->oldbottom = vst->bottom;
! 	
! 	gdi.enableZBuffer();
! 
! 	vs->alloctwobuffers = twobufs;
! }
! 
! int Scumm::getVerbSlot(int id, int mode) {
! 	int i;
! 	for (i=1; i<_maxVerbs; i++) {
! 		if (_verbs[i].verbid == id && _verbs[i].saveid == mode) {
! 			return i;
! 		}
! 	}
! 	return 0;
! }
! 
! void Scumm::killVerb(int slot) {
! 	VerbSlot *vs;
! 
! 	if (slot==0)
! 		return;
! 
! 	vs = &_verbs[slot];
! 	vs->verbid = 0;
! 	vs->curmode = 0;
! 
! 	nukeResource(rtVerb, slot);
! 
! 	if (vs->saveid==0) {
! 		drawVerb(slot, 0);
! 		verbMouseOver(0);
! 	}
! 	vs->saveid = 0;
! }
! 
! void Scumm::setVerbObject(uint room, uint object, uint verb) {
! 	byte  *obimptr;
! 	uint32 size;
! 	FindObjectInRoom foir;
! 
! 	if (whereIsObject(object) == WIO_FLOBJECT)
! 		error("Can't grab verb image from flobject");
! 
! 	findObjectInRoom(&foir, foImageHeader, object, room);
! 	size = READ_BE_UINT32_UNALIGNED(foir.obim+4);
! 	createResource(rtVerb, verb, size);
! 	obimptr = getResourceAddress(rtRoom, room) - foir.roomptr + foir.obim;
! 	memcpy(getResourceAddress(rtVerb, verb), obimptr, size);
! }

Index: whatsnew.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/whatsnew.txt,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -C2 -d -r1.1.1.1 -r1.1.1.1.2.1
*** whatsnew.txt	2001/10/09 14:30:12	1.1.1.1
--- whatsnew.txt	2001/12/20 00:18:03	1.1.1.1.2.1
***************
*** 1,2 ****
--- 1,6 ----
+ 0.0.2 (2001-10-12):
+ - bug fixes
+ - save & load support
+ 
  0.0.1 (2001-10-08):
  - initial version





More information about the Scummvm-git-logs mailing list