[Scummvm-cvs-logs] CVS: scummvm actor.cpp,1.46,1.47 object.cpp,1.52,1.53 resource.cpp,1.62,1.63 script.cpp,1.45,1.46 script_v1.cpp,1.72,1.73
Ludvig Strigeus
strigeus at users.sourceforge.net
Thu Apr 11 08:28:59 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv28972
Modified Files:
actor.cpp object.cpp resource.cpp script.cpp script_v1.cpp
Log Message:
various code cleanups
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** actor.cpp 11 Apr 2002 14:22:45 -0000 1.46
--- actor.cpp 11 Apr 2002 15:22:01 -0000 1.47
***************
*** 466,470 ****
uint threshold;
uint best;
! int box, iterations = 0; /* Use inerations for those odd times we get stuck in the loop */
int firstValidBox,j;
byte flags, b;
--- 466,470 ----
uint threshold;
uint best;
! int box, iterations = 0; /* Use iterations for those odd times we get stuck in the loop */
int firstValidBox,j;
byte flags, b;
***************
*** 479,488 ****
abr.dist = 0;
if (a && a->ignoreBoxes==0) {
threshold = 30;
- if ((_features & GF_SMALL_HEADER) && (_classData[a->number] & 0x200000))
- return abr;
-
while(1) {
iterations++;
--- 479,488 ----
abr.dist = 0;
+ if ((_features & GF_SMALL_HEADER) && getClass(a->number, 21))
+ return abr;
+
if (a && a->ignoreBoxes==0) {
threshold = 30;
while(1) {
iterations++;
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** object.cpp 7 Apr 2002 04:29:14 -0000 1.52
--- object.cpp 11 Apr 2002 15:22:01 -0000 1.53
***************
*** 30,41 ****
if (_features & GF_SMALL_HEADER) {
- byte *oldClass = (byte*)&_classData[obj];
if (cls == 32) // CLASS_TOUCHABLE
cls = 23;
-
- return (oldClass[cls/8] & bit_table[cls&0x07]) != 0;
- } else {
- return (_classData[obj] & (1<<(cls-1))) != 0;
}
}
--- 30,37 ----
if (_features & GF_SMALL_HEADER) {
if (cls == 32) // CLASS_TOUCHABLE
cls = 23;
}
+ return (_classData[obj] & (1<<(cls-1))) != 0;
}
***************
*** 46,64 ****
if (_features & GF_SMALL_HEADER) {
- byte *oldClass = (byte*)&_classData[obj];
if (cls == 32) // CLASS_TOUCHABLE
cls = 23;
-
- if (set)
- oldClass[cls/8] |= bit_table[cls&0x07];
- else
- oldClass[cls/8] &= bit_table[cls&0x07]^0xff;
-
- } else {
- if (set)
- _classData[obj] |= (1<<(cls-1));
- else
- _classData[obj] &= ~(1<<(cls-1));
}
}
--- 42,52 ----
if (_features & GF_SMALL_HEADER) {
if (cls == 32) // CLASS_TOUCHABLE
cls = 23;
}
+ if (set)
+ _classData[obj] |= (1<<(cls-1));
+ else
+ _classData[obj] &= ~(1<<(cls-1));
}
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -d -r1.62 -r1.63
*** resource.cpp 31 Mar 2002 09:06:51 -0000 1.62
--- resource.cpp 11 Apr 2002 15:22:02 -0000 1.63
***************
*** 273,283 ****
}
fileRead(_fileHandle, _classData, num * sizeof(uint32));
!
! /* #if defined(SCUMM_BIG_ENDIAN)
! for (i=0; i<num; i++) {
_classData[i] = FROM_LE_32(_classData[i]);
}
! #endif */ // ?? FIXME Remove according to Morphos diff.
!
break;
--- 273,284 ----
}
fileRead(_fileHandle, _classData, num * sizeof(uint32));
!
! /* This code should be here. Otherwise the flags will be swapped for big endian computers.
! * If it doesn't work with this code, something else is wrong */
! #if defined(SCUMM_BIG_ENDIAN)
! for (i=0; i!=num; i++) {
_classData[i] = FROM_LE_32(_classData[i]);
}
! #endif
break;
***************
*** 399,404 ****
byte *ptr;
! debug(9, "loadCharset(%d)",no);
!
memset(_charsetData, 0, sizeof(_charsetData));
--- 400,407 ----
byte *ptr;
! debug(9, "loadCharset(%d)",no);
!
!
!
memset(_charsetData, 0, sizeof(_charsetData));
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** script.cpp 7 Apr 2002 04:29:14 -0000 1.45
--- script.cpp 11 Apr 2002 15:22:02 -0000 1.46
***************
*** 40,47 ****
if (script < _numGlobalScripts) {
scriptPtr = getResourceAddress(rtScript, script);
! if(_features & GF_SMALL_HEADER)
! scriptOffs = 6;
! else
! scriptOffs = 8;
scriptType = WIO_GLOBAL;
} else {
--- 40,44 ----
if (script < _numGlobalScripts) {
scriptPtr = getResourceAddress(rtScript, script);
! scriptOffs = _resourceHeaderSize;
scriptType = WIO_GLOBAL;
} else {
Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -d -r1.72 -r1.73
*** script_v1.cpp 7 Apr 2002 04:29:14 -0000 1.72
--- script_v1.cpp 11 Apr 2002 15:22:02 -0000 1.73
***************
*** 691,695 ****
void Scumm::o5_actorSet() {
! byte convertTable[20] = {1,0,0,2,0,4,5,6,7,8,9,10,11,12,13,14,15,16,17,20};
int act = getVarOrDirectByte(0x80);
Actor *a;
--- 691,695 ----
void Scumm::o5_actorSet() {
! static const byte convertTable[20] = {1,0,0,2,0,4,5,6,7,8,9,10,11,12,13,14,15,16,17,20};
int act = getVarOrDirectByte(0x80);
Actor *a;
***************
*** 816,820 ****
int act = getVarOrDirectWord(0x80);
int newClass;
- byte *oldClassData;
while ( (_opcode=fetchScriptByte()) != 0xFF) {
--- 816,819 ----
***************
*** 825,840 ****
}
! if(_features & GF_SMALL_HEADER) {
! oldClassData=(byte*)&_classData[act];
! if (newClass&0x80)
! oldClassData[((newClass-1)&0x7f)/8] |= bit_table[((newClass-1)&0x07)];
! else
! oldClassData[((newClass-1)&0x7f)/8] &= bit_table[((newClass-1)&0x07)]^0xff;
! } else {
! if (newClass&0x80)
! putClass(act, newClass, 1);
! else
! putClass(act, newClass, 0);
! }
}
}
--- 824,831 ----
}
! if (newClass&0x80)
! putClass(act, newClass, 1);
! else
! putClass(act, newClass, 0);
}
}
***************
*** 1350,1354 ****
int act,cls, b;
bool cond = true;
- byte *oldClass;
act = getVarOrDirectWord(0x80);
--- 1341,1344 ----
***************
*** 1356,1365 ****
while ( (_opcode = fetchScriptByte()) != 0xFF) {
cls = getVarOrDirectWord(0x80);
! oldClass = (byte*)&_classData[act];
!
! if(_features & GF_SMALL_HEADER)
! b = oldClass[((cls-1)&0x7f)/8] & bit_table[((cls-1)&0x07)];
! else
! b = getClass(act, cls);
if (cls&0x80 && !b || !(cls&0x80) && b)
--- 1346,1350 ----
while ( (_opcode = fetchScriptByte()) != 0xFF) {
cls = getVarOrDirectWord(0x80);
! b = getClass(act, cls);
if (cls&0x80 && !b || !(cls&0x80) && b)
More information about the Scummvm-git-logs
mailing list