[Scummvm-cvs-logs] CVS: scummvm scumm.h,1.18,1.19 scummvm.cpp,1.18,1.19 resource.cpp,1.11,1.12 object.cpp,1.10,1.11 verbs.cpp,1.6,1.7

Ludvig Strigeus strigeus at users.sourceforge.net
Tue Nov 6 13:42:10 CET 2001


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

Modified Files:
	scumm.h scummvm.cpp resource.cpp object.cpp verbs.cpp 
Log Message:
removed some hardcoded constants

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** scumm.h	2001/11/06 20:00:47	1.18
--- scumm.h	2001/11/06 21:41:56	1.19
***************
*** 750,754 ****
  
  	int _drawObjectQueNr;
! 	byte _drawObjectQue[0xC8];
  
  	uint16 _currentDrive;
--- 750,754 ----
  
  	int _drawObjectQueNr;
! 	byte _drawObjectQue[200];
  
  	uint16 _currentDrive;
***************
*** 1574,1577 ****
--- 1574,1579 ----
  
  	void decompressDefaultCursor(int index);
+ 
+ 	void allocateArrays();
  };
  

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** scummvm.cpp	2001/11/06 21:29:23	1.18
--- scummvm.cpp	2001/11/06 21:41:56	1.19
***************
*** 31,50 ****
  	_numVerbs = 100;
  	_numInventory = 80;
  	
! 	_inventory = (uint16*)alloc(_numInventory * sizeof(uint16));
! 	_verbs = (VerbSlot*)alloc(100 * sizeof(VerbSlot));
! 	_objs = (ObjectData*)alloc(200 * sizeof(ObjectData));
! 	_vars = (int16*)alloc(800 * sizeof(int16));
! 	_bitVars = (byte*)alloc(2048 >> 3);
! 
! 	allocResTypeData(5, MKID('NONE'),	0x50, "inventory", 0);
! 	allocResTypeData(12,MKID('NONE'),10, "temp", 0);
! 	allocResTypeData(11,MKID('NONE'),5, "scale table", 0);
! 	allocResTypeData(9, MKID('NONE'),13,"actor name", 0);
! 	allocResTypeData(10, MKID('NONE'),10,"buffer", 0);
!  	allocResTypeData(8, MKID('NONE'),100,"verb", 0);
! 	allocResTypeData(7, MKID('NONE'),0x32,"string", 0);
! 	allocResTypeData(13, MKID('NONE'),0x32,"flobject", 0);
! 	allocResTypeData(14, MKID('NONE'),10,"boxes", 0);
  	readIndexFileV5(2);
  	initRandSeeds();
--- 31,40 ----
  	_numVerbs = 100;
  	_numInventory = 80;
+ 	_numVerbs = 100;
+ 	_numArray = 0x32;
+ 	_numFlObject = 0x32;
  	
! 	allocateArrays();
! 	
  	readIndexFileV5(2);
  	initRandSeeds();

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** resource.cpp	2001/11/06 21:29:23	1.11
--- resource.cpp	2001/11/06 21:41:56	1.12
***************
*** 825,846 ****
  	allocResTypeData(2, MKID('SCRP'), _numScripts, "script", 1);
  	allocResTypeData(6, MKID('CHAR'), _numCharsets, "charset", 1);
! 	allocResTypeData(5, MKID('NONE'),	_numInventory, "inventory", 0);
! 	allocResTypeData(8, MKID('NONE'), _numVerbs,"verb", 0);
! 	allocResTypeData(7, MKID('NONE'), _numArray,"array", 0);
! 	allocResTypeData(13, MKID('NONE'),_numFlObject,"flobject", 0);
! 	allocResTypeData(12,MKID('NONE'),10, "temp", 0);
! 	allocResTypeData(11,MKID('NONE'),5, "scale table", 0);
! 	allocResTypeData(9, MKID('NONE'),13,"actor name", 0);
! 	allocResTypeData(10, MKID('NONE'),10,"buffer", 0);
! 	allocResTypeData(14, MKID('NONE'),10,"boxes", 0);
  	allocResTypeData(16, MKID('NONE'),50,"new name", 0);
  
  	_objectFlagTable = (byte*)alloc(_numGlobalObjects);
- 	_inventory = (uint16*)alloc(_numInventory * sizeof(uint16));
  	_arrays = (byte*)alloc(_numArray);
- 	_verbs = (VerbSlot*)alloc(_numVerbs * sizeof(VerbSlot));
- 	_objs = (ObjectData*)alloc(_numLocalObjects * sizeof(ObjectData));
- 	_vars = (int16*)alloc(_numVariables * sizeof(int16));
- 	_bitVars = (byte*)alloc(_numBitVariables >> 3);
  	_newNames = (uint16*)alloc(50 * sizeof(uint16));
  	_classData = (uint32*)alloc(_numGlobalObjects * sizeof(uint32));
--- 825,835 ----
  	allocResTypeData(2, MKID('SCRP'), _numScripts, "script", 1);
  	allocResTypeData(6, MKID('CHAR'), _numCharsets, "charset", 1);
! 	
  	allocResTypeData(16, MKID('NONE'),50,"new name", 0);
  
+ 	allocateArrays();
+ 
  	_objectFlagTable = (byte*)alloc(_numGlobalObjects);
  	_arrays = (byte*)alloc(_numArray);
  	_newNames = (uint16*)alloc(50 * sizeof(uint16));
  	_classData = (uint32*)alloc(_numGlobalObjects * sizeof(uint32));
***************
*** 850,852 ****
--- 839,857 ----
  }
  
+ void Scumm::allocateArrays() {
+ 	_inventory = (uint16*)alloc(_numInventory * sizeof(uint16));
+ 	_verbs = (VerbSlot*)alloc(_numVerbs * sizeof(VerbSlot));
+ 	_objs = (ObjectData*)alloc(_numLocalObjects * sizeof(ObjectData));
+ 	_vars = (int16*)alloc(_numVariables * sizeof(int16));
+ 	_bitVars = (byte*)alloc(_numBitVariables >> 3);
  
+ 	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'),13,"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: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** object.cpp	2001/11/06 21:29:23	1.10
--- object.cpp	2001/11/06 21:41:56	1.11
***************
*** 494,498 ****
  void Scumm::addObjectToDrawQue(int object) {
  	_drawObjectQue[_drawObjectQueNr++] = object;
! 	if (_drawObjectQueNr > 200)
  		error("Draw Object Que overflow");
  }
--- 494,498 ----
  void Scumm::addObjectToDrawQue(int object) {
  	_drawObjectQue[_drawObjectQueNr++] = object;
! 	if (_drawObjectQueNr > sizeof(_drawObjectQue)/sizeof(_drawObjectQue[0]))
  		error("Draw Object Que overflow");
  }
***************
*** 581,586 ****
  	if (numobj==0)
  		error("addObjectToInventory: No object found in room %d", room);
! 	if (numobj > 200)
! 		error("addObjectToInventory: More (%d) than %d objects in room %d", numobj, 200, room);
  
  	for (i=0; i<numobj; i++) {
--- 581,586 ----
  	if (numobj==0)
  		error("addObjectToInventory: No object found in room %d", room);
! 	if (numobj > _numLocalObjects)
! 		error("addObjectToInventory: More (%d) than %d objects in room %d", numobj, _numLocalObjects, room);
  
  	for (i=0; i<numobj; i++) {

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/verbs.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** verbs.cpp	2001/11/06 20:00:47	1.6
--- verbs.cpp	2001/11/06 21:41:56	1.7
***************
*** 261,266 ****
  	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++) {
--- 261,266 ----
  	if (numobj==0)
  		error("No images found in room %d", room);
! 	if (numobj > _numLocalObjects)
! 		error("More (%d) than %d objects in room %d", numobj, _numLocalObjects, room);
  
  	for (i=0; i<numobj; i++) {





More information about the Scummvm-git-logs mailing list