[Scummvm-cvs-logs] CVS: scummvm string.cpp,1.7,1.8 scummsys.h,1.9,1.10 scumm.h,1.19,1.20 script_v2.cpp,1.6,1.7 script_v1.cpp,1.7,1.8 script.cpp,1.8,1.9 saveload.cpp,1.9,1.10 resource.cpp,1.12,1.13 object.cpp,1.11,1.12 gfx.cpp,1.13,1.14 debug.cpp,1.5,1.6 actor.cpp,1.9,1.10
Ludvig Strigeus
strigeus at users.sourceforge.net
Wed Nov 7 10:11:03 CET 2001
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv19865
Modified Files:
string.cpp scummsys.h scumm.h script_v2.cpp script_v1.cpp
script.cpp saveload.cpp resource.cpp object.cpp gfx.cpp
debug.cpp actor.cpp
Log Message:
debugger fix,
removed hardcoded constants,
resouce lock state is now saved in the savegame,
fixed bug with MI1
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/string.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** string.cpp 2001/11/06 20:00:47 1.7
--- string.cpp 2001/11/07 18:10:51 1.8
***************
*** 235,242 ****
if (_keepText) {
! charset._strLeft = string[0].mask_left;
! charset._strRight = string[0].mask_right;
! charset._strTop = string[0].mask_top;
! charset._strBottom = string[0].mask_bottom;
}
--- 235,242 ----
if (_keepText) {
! charset._strLeft = gdi._mask_left;
! charset._strRight = gdi._mask_right;
! charset._strTop = gdi._mask_top;
! charset._strBottom = gdi._mask_bottom;
}
***************
*** 259,270 ****
if (!_keepText) {
restoreCharsetBg();
! string[0].xpos2 = string[0].xpos;
! string[0].ypos2 = string[0].ypos;
}
t = charset._right - string[0].xpos - 1;
if (charset._center) {
! if (t > string[0].xpos2)
! t = string[0].xpos2;
t <<= 1;
}
--- 259,270 ----
if (!_keepText) {
restoreCharsetBg();
! charset._xpos2 = string[0].xpos;
! charset._ypos2 = string[0].ypos;
}
t = charset._right - string[0].xpos - 1;
if (charset._center) {
! if (t > charset._xpos2)
! t = charset._xpos2;
t <<= 1;
}
***************
*** 276,280 ****
_lastXstart = virtscr[0].xstart;
if (charset._center) {
! string[0].xpos2 -= charset.getStringWidth(0, buffer,0) >> 1;
}
--- 276,280 ----
_lastXstart = virtscr[0].xstart;
if (charset._center) {
! charset._xpos2 -= charset.getStringWidth(0, buffer,0) >> 1;
}
***************
*** 290,298 ****
if (c == 13) {
newLine:;
! string[0].xpos2 = string[0].xpos;
if (charset._center) {
! string[0].xpos2 -= charset.getStringWidth(0, buffer, 0)>>1;
}
! string[0].ypos2 += getResourceAddress(rtCharset,charset._curId)[30];
charset._disableOffsX = 1;
continue;
--- 290,298 ----
if (c == 13) {
newLine:;
! charset._xpos2 = string[0].xpos;
if (charset._center) {
! charset._xpos2 -= charset.getStringWidth(0, buffer, 0)>>1;
}
! charset._ypos2 += getResourceAddress(rtCharset,charset._curId)[30];
charset._disableOffsX = 1;
continue;
***************
*** 302,307 ****
if (c!=0xFF) {
! charset._left = string[0].xpos2;
! charset._top = string[0].ypos2;
if (_majorScummVersion==5) {
--- 302,307 ----
if (c!=0xFF) {
! charset._left = charset._xpos2;
! charset._top = charset._ypos2;
if (_majorScummVersion==5) {
***************
*** 313,318 ****
}
! string[0].xpos2 = charset._left;
! string[0].ypos2 = charset._top;
_talkDelay += _vars[VAR_CHARINC];
--- 313,318 ----
}
! charset._xpos2 = charset._left;
! charset._ypos2 = charset._top;
_talkDelay += _vars[VAR_CHARINC];
***************
*** 350,354 ****
for (i=0; i<4; i++)
charset._colorMap[i] = _charsetData[charset._curId][i];
! string[0].ypos2 -= getResourceAddress(rtCharset,charset._curId)[30] - oldy;
} else if (c==12) {
int color;
--- 350,354 ----
for (i=0; i<4; i++)
charset._colorMap[i] = _charsetData[charset._curId][i];
! charset._ypos2 -= getResourceAddress(rtCharset,charset._curId)[30] - oldy;
} else if (c==12) {
int color;
***************
*** 368,375 ****
charset._bufPos = buffer - charset._buffer;
! string[0].mask_left = charset._strLeft;
! string[0].mask_right = charset._strRight;
! string[0].mask_top = charset._strTop;
! string[0].mask_bottom = charset._strBottom;
}
--- 368,375 ----
charset._bufPos = buffer - charset._buffer;
! gdi._mask_left = charset._strLeft;
! gdi._mask_right = charset._strRight;
! gdi._mask_top = charset._strTop;
! gdi._mask_bottom = charset._strBottom;
}
***************
*** 463,468 ****
charset._ignoreCharsetMask = 0;
! string[a].xpos2 = charset._left;
! string[a].ypos2 = charset._top;
}
--- 463,471 ----
charset._ignoreCharsetMask = 0;
!
! if (a==0) {
! charset._xpos2 = charset._left;
! charset._ypos2 = charset._top;
! }
}
Index: scummsys.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummsys.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** scummsys.h 2001/11/06 20:00:47 1.9
--- scummsys.h 2001/11/07 18:10:51 1.10
***************
*** 74,78 ****
#define FORCEINLINE inline
! #define NORETURN
#define CDECL
--- 74,82 ----
#define FORCEINLINE inline
!
! #if defined(__GNUC__)
! #define NORETURN __dead2
! #else
! #endif
#define CDECL
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** scumm.h 2001/11/06 21:41:56 1.19
--- scumm.h 2001/11/07 18:10:51 1.20
***************
*** 24,29 ****
#define SWAP(a,b) do{int tmp=a; a=b; b=tmp; } while(0)
- #define BYPASS_COPY_PROT
-
struct Scumm;
struct Actor;
--- 24,27 ----
***************
*** 63,67 ****
uint8 charset_nr,curmode;
uint8 saveid;
! uint8 key,center;
uint8 field_1B;
uint16 imgindex;
--- 61,66 ----
uint8 charset_nr,curmode;
uint8 saveid;
! uint8 key;
! bool center;
uint8 field_1B;
uint16 imgindex;
***************
*** 345,350 ****
int _strLeft, _strRight, _strTop, _strBottom;
- // int _mask_bottom, _mask_right, _mask_top, _mask_left;
byte _curId;
byte _bufPos;
--- 344,350 ----
int _strLeft, _strRight, _strTop, _strBottom;
byte _curId;
+
+ int _xpos2, _ypos2;
byte _bufPos;
***************
*** 487,498 ****
struct StringTab {
! int16 t_xpos, t_ypos, t_center, t_overhead;
! int16 t_no_talk_anim, t_right, t_color, t_charset;
int16 xpos, ypos;
! int16 xpos2,ypos2;
! int16 center, overhead;
! int16 no_talk_anim, right;
! int16 color,charset;
! int16 mask_top, mask_bottom, mask_right, mask_left;
};
--- 487,499 ----
struct StringTab {
! int16 t_xpos, t_ypos;
! int16 t_right;
int16 xpos, ypos;
! int16 right;
! byte color, t_color;
! byte charset, t_charset;
! bool center, t_center;
! bool overhead, t_overhead;
! bool no_talk_anim,t_no_talk_anim;
};
***************
*** 525,528 ****
--- 526,530 ----
int16 _drawMouseX;
int16 _drawMouseY;
+ int16 _mask_top, _mask_bottom, _mask_right, _mask_left;
byte _currentCursor;
byte _mouseColors[4];
***************
*** 780,784 ****
ScriptSlot slot[NUM_SCRIPT_SLOT];
NestedScript nest[15];
! int16 localvar[NUM_SCRIPT_SLOT*17];
} vm;
--- 782,786 ----
ScriptSlot slot[NUM_SCRIPT_SLOT];
NestedScript nest[15];
! int16 localvar[NUM_SCRIPT_SLOT][17];
} vm;
***************
*** 1009,1014 ****
byte fetchScriptByte();
int fetchScriptWord();
! void ignoreScriptWord();
! void ignoreScriptByte();
int getVarOrDirectWord(byte mask);
int getVarOrDirectByte(byte mask);
--- 1011,1016 ----
byte fetchScriptByte();
int fetchScriptWord();
! void ignoreScriptWord() { fetchScriptWord(); }
! void ignoreScriptByte() { fetchScriptByte(); }
int getVarOrDirectWord(byte mask);
int getVarOrDirectByte(byte mask);
***************
*** 1576,1579 ****
--- 1578,1583 ----
void allocateArrays();
+
+ void initializeLocals(int slot, int16 *vars);
};
***************
*** 1645,1649 ****
void blitToScreen(Scumm *s, byte *src, int x, int y, int w, int h);
! void NORETURN CDECL error(const char *s, ...);
void CDECL warning(const char *s, ...);
void CDECL debug(int level, const char *s, ...);
--- 1649,1653 ----
void blitToScreen(Scumm *s, byte *src, int x, int y, int w, int h);
! void CDECL error(const char *s, ...) NORETURN;
void CDECL warning(const char *s, ...);
void CDECL debug(int level, const char *s, ...);
Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v2.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** script_v2.cpp 2001/11/06 20:00:47 1.6
--- script_v2.cpp 2001/11/07 18:10:51 1.7
***************
*** 2066,2070 ****
string[m].ypos = pop();
string[m].xpos = pop();
! string[m].overhead = 0;
break;
case 66:
--- 2066,2070 ----
string[m].ypos = pop();
string[m].xpos = pop();
! string[m].overhead = false;
break;
case 66:
***************
*** 2075,2088 ****
break;
case 69:
! string[m].center = 1;
! string[m].overhead = 0;
break;
case 71:
! string[m].center = 0;
! string[m].overhead = 0;
break;
case 72:
! string[m].overhead = 1;
! string[m].no_talk_anim = 0;
break;
case 73:
--- 2075,2088 ----
break;
case 69:
! string[m].center = true;
! string[m].overhead = false;
break;
case 71:
! string[m].center = false;
! string[m].overhead = false;
break;
case 72:
! string[m].overhead = true;
! string[m].no_talk_anim = false;
break;
case 73:
***************
*** 2090,2094 ****
break;
case 74:
! string[m].no_talk_anim = 1;
break;
case 75:
--- 2090,2094 ----
break;
case 74:
! string[m].no_talk_anim = true;
break;
case 75:
Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** script_v1.cpp 2001/11/06 20:00:47 1.7
--- script_v1.cpp 2001/11/07 18:10:51 1.8
***************
*** 1936,1940 ****
string[textSlot].xpos = getVarOrDirectWord(0x80);
string[textSlot].ypos = getVarOrDirectWord(0x40);
! string[textSlot].overhead = 0;
break;
case 1: /* color */
--- 1936,1940 ----
string[textSlot].xpos = getVarOrDirectWord(0x80);
string[textSlot].ypos = getVarOrDirectWord(0x40);
! string[textSlot].overhead = false;
break;
case 1: /* color */
***************
*** 1945,1957 ****
break;
case 4: /* center*/
! string[textSlot].center = 1;
! string[textSlot].overhead = 0;
break;
case 6: /* left */
! string[textSlot].center = 0;
! string[textSlot].overhead = 0;
break;
case 7: /* overhead */
! string[textSlot].overhead = 1;
break;
case 8: /* ignore */
--- 1945,1957 ----
break;
case 4: /* center*/
! string[textSlot].center = true;
! string[textSlot].overhead = false;
break;
case 6: /* left */
! string[textSlot].center = false;
! string[textSlot].overhead = false;
break;
case 7: /* overhead */
! string[textSlot].overhead = true;
break;
case 8: /* ignore */
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** script.cpp 2001/11/06 21:29:23 1.8
--- script.cpp 2001/11/07 18:10:51 1.9
***************
*** 29,33 ****
uint32 scriptOffs;
byte scriptType;
! int slot,i;
ScriptSlot *s;
--- 29,33 ----
uint32 scriptOffs;
byte scriptType;
! int slot;
ScriptSlot *s;
***************
*** 65,77 ****
s->unk2 = b;
s->freezeCount = 0;
-
- if (lvarptr==NULL) {
- for(i=0; i<16; i++)
- vm.localvar[slot * 0x11 + i] = 0;
- } else {
- for(i=0; i<16; i++)
- vm.localvar[slot * 0x11 + i] = lvarptr[i];
- }
runScriptNested(slot);
}
--- 65,71 ----
s->unk2 = b;
s->freezeCount = 0;
+ initializeLocals(slot, lvarptr);
+
runScriptNested(slot);
}
***************
*** 180,184 ****
}
! if (++_numNestedScripts>=0x10)
error("Too many nested scripts");
--- 174,178 ----
}
! if (++_numNestedScripts>sizeof(vm.nest)/sizeof(vm.nest[0]))
error("Too many nested scripts");
***************
*** 270,274 ****
byte Scumm::fetchScriptByte() {
! if (*_lastCodePtr != _scriptOrgPointer + 6) {
uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
getScriptBaseAddress();
--- 264,268 ----
byte Scumm::fetchScriptByte() {
! if (*_lastCodePtr + sizeof(ResHeader) != _scriptOrgPointer) {
uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
getScriptBaseAddress();
***************
*** 280,306 ****
int Scumm::fetchScriptWord() {
int a;
!
! if (*_lastCodePtr != _scriptOrgPointer + 6) {
uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
getScriptBaseAddress();
_scriptPointer = _scriptOrgPointer + oldoffs;
}
-
a = READ_LE_UINT16(_scriptPointer);
_scriptPointer += 2;
-
- debug(9, "fetchword=%d", a);
return a;
}
- void Scumm::ignoreScriptWord() {
- fetchScriptWord();
- }
-
- void Scumm::ignoreScriptByte() {
- fetchScriptByte();
- }
-
-
int Scumm::readVar(uint var) {
int a;
--- 274,287 ----
int Scumm::fetchScriptWord() {
int a;
! if (*_lastCodePtr + sizeof(ResHeader) != _scriptOrgPointer) {
uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
getScriptBaseAddress();
_scriptPointer = _scriptOrgPointer + oldoffs;
}
a = READ_LE_UINT16(_scriptPointer);
_scriptPointer += 2;
return a;
}
int Scumm::readVar(uint var) {
int a;
***************
*** 335,345 ****
checkRange(0x10, 0, var, "Local variable %d out of range(r)");
! #ifdef BYPASS_COPY_PROT
! if (!copyprotbypassed && _currentScript==1 && _gameId==GID_MONKEY2) {
copyprotbypassed=1;
return 1;
}
#endif
! return vm.localvar[_currentScript * 17 + var];
}
--- 316,326 ----
checkRange(0x10, 0, var, "Local variable %d out of range(r)");
! #if defined(BYPASS_COPY_PROT)
! if (!copyprotbypassed && _currentScript==1 && _gameId==GID_MONKEY2 && var==0) {
copyprotbypassed=1;
return 1;
}
#endif
! return vm.localvar[_currentScript][var];
}
***************
*** 369,373 ****
var &= 0xFFF;
checkRange(0x10, 0, var, "Local variable %d out of range(w)");
! vm.localvar[_currentScript * 17 + var] = value;
return;
}
--- 350,354 ----
var &= 0xFFF;
checkRange(0x10, 0, var, "Local variable %d out of range(w)");
! vm.localvar[_currentScript][var] = value;
return;
}
***************
*** 389,394 ****
_resultVarNumber&=~0x2000;
}
-
- debug(9, "getResultPos=%d", _resultVarNumber);
}
--- 370,373 ----
***************
*** 588,592 ****
do {
if (_objs[i].fl_object_index)
! nukeResource(0xD, _objs[i].fl_object_index);
} while (++i <= _numObjectsInRoom);
--- 567,571 ----
do {
if (_objs[i].fl_object_index)
! nukeResource(rtFlObject, _objs[i].fl_object_index);
} while (++i <= _numObjectsInRoom);
***************
*** 656,664 ****
}
-
-
void Scumm::runVerbCode(int object, int entry, int a, int b, int16 *vars) {
uint32 obcd;
! int slot, where, offs,i;
if (!object)
--- 635,641 ----
}
void Scumm::runVerbCode(int object, int entry, int a, int b, int16 *vars) {
uint32 obcd;
! int slot, where, offs;
if (!object)
***************
*** 689,701 ****
vm.slot[slot].newfield = 0;
if (!vars) {
for(i=0; i<16; i++)
! vm.localvar[slot * 17 + i] = 0;
} else {
for (i=0; i<16; i++)
! vm.localvar[slot * 17 + i] = vars[i];
}
-
- runScriptNested(slot);
}
--- 666,683 ----
vm.slot[slot].newfield = 0;
+ initializeLocals(slot, vars);
+
+ runScriptNested(slot);
+ }
+
+ void Scumm::initializeLocals(int slot, int16 *vars) {
+ int i;
if (!vars) {
for(i=0; i<16; i++)
! vm.localvar[slot][i] = 0;
} else {
for (i=0; i<16; i++)
! vm.localvar[slot][i] = vars[i];
}
}
***************
*** 768,772 ****
vm.slot[scr].cutsceneOverride++;
! if (++vm.cutSceneStackPointer > 5)
error("Cutscene stack overflow");
--- 750,754 ----
vm.slot[scr].cutsceneOverride++;
! if (++vm.cutSceneStackPointer > sizeof(vm.cutSceneData)/sizeof(vm.cutSceneData[0]))
error("Cutscene stack overflow");
Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saveload.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** saveload.cpp 2001/11/06 21:29:23 1.9
--- saveload.cpp 2001/11/07 18:10:51 1.10
***************
*** 29,33 ****
};
! #define CURRENT_VER 2
bool Scumm::saveState(const char *filename) {
--- 29,33 ----
};
! #define CURRENT_VER 3
bool Scumm::saveState(const char *filename) {
***************
*** 84,90 ****
/* Nuke all resources */
for (i=1; i<=16; i++)
! if (!(i==rtFlObject || i==rtTemp || i==rtBuffer || res.mode[i]))
! for(j=0; j<res.num[i]; j++)
nukeResource(i,j);
initScummVars();
--- 84,92 ----
/* Nuke all resources */
for (i=1; i<=16; i++)
! if (i!=rtTemp && i!=rtBuffer)
! for(j=0; j<res.num[i]; j++) {
nukeResource(i,j);
+ res.flags[i][j] = 0;
+ }
initScummVars();
***************
*** 97,100 ****
--- 99,104 ----
sb = _screenB;
sh = _screenH;
+
+ gdi._mask_left = -1;
initScreens(0, 0, 320, 200);
***************
*** 253,257 ****
MKLINE(Scumm,_currentScript,sleByte),
MKARRAY(Scumm,_localScriptList[0],sleUint32,0x39),
! MKARRAY(Scumm,vm.localvar[0],sleUint16,NUM_SCRIPT_SLOT*17),
MKARRAY(Scumm,_resourceMapper[0],sleByte,128),
MKARRAY(Scumm,charset._colorMap[0],sleByte,16),
--- 257,261 ----
MKLINE(Scumm,_currentScript,sleByte),
MKARRAY(Scumm,_localScriptList[0],sleUint32,0x39),
! MKARRAY(Scumm,vm.localvar[0][0],sleUint16,NUM_SCRIPT_SLOT*17),
MKARRAY(Scumm,_resourceMapper[0],sleByte,128),
MKARRAY(Scumm,charset._colorMap[0],sleByte,16),
***************
*** 326,329 ****
--- 330,334 ----
MKARRAY(Scumm,cost._transEffect[0],sleByte,256),
+
MKEND()
};
***************
*** 364,370 ****
MKLINE(StringTab,t_xpos,sleInt16),
MKLINE(StringTab,t_ypos,sleInt16),
! MKLINE(StringTab,t_center,sleInt16),
! MKLINE(StringTab,t_overhead,sleInt16),
! MKLINE(StringTab,t_no_talk_anim,sleInt16),
MKLINE(StringTab,t_right,sleInt16),
MKLINE(StringTab,t_color,sleInt16),
--- 369,375 ----
MKLINE(StringTab,t_xpos,sleInt16),
MKLINE(StringTab,t_ypos,sleInt16),
! MKLINE(StringTab,t_center,sleByte),
! MKLINE(StringTab,t_overhead,sleByte),
! MKLINE(StringTab,t_no_talk_anim,sleByte),
MKLINE(StringTab,t_right,sleInt16),
MKLINE(StringTab,t_color,sleInt16),
***************
*** 372,385 ****
MKLINE(StringTab,xpos,sleInt16),
MKLINE(StringTab,ypos,sleInt16),
- MKLINE(StringTab,xpos2,sleInt16),
- MKLINE(StringTab,ypos2,sleInt16),
MKLINE(StringTab,center,sleInt16),
MKLINE(StringTab,overhead,sleInt16),
MKLINE(StringTab,no_talk_anim,sleInt16),
MKLINE(StringTab,right,sleInt16),
- MKLINE(StringTab,mask_top,sleInt16),
- MKLINE(StringTab,mask_bottom,sleInt16),
- MKLINE(StringTab,mask_right,sleInt16),
- MKLINE(StringTab,mask_left,sleInt16),
MKEND()
};
--- 377,384 ----
***************
*** 407,436 ****
s->saveLoadArrayOf(_colorCycle, 16, sizeof(_colorCycle[0]), colorCycleEntries);
- // debug(1, "1) At position %d", ftell(inout));
- // for (i=1; i<13; i++)
- // s->saveLoadEntries(&actor[i],actorEntries);
- // debug(1, "2) At position %d", ftell(inout));
- // for (i=0; i<NUM_SCRIPT_SLOT; i++)
- // s->saveLoadEntries(&vm.slot[i],scriptSlotEntries);
- // debug(1, "3) At position %d", ftell(inout));
- // for (i=0; i<_numLocalObjects; i++)
- // s->saveLoadEntries(&_objs[i],objectEntries);
- // debug(1, "4) At position %d", ftell(inout));
- // for (i=0; i<_numVerbs; i++)
- // s->saveLoadEntries(&_verbs[i],verbEntries);
- // debug(1, "5) At position %d", ftell(inout));
- // for (i=0; i<16; i++)
- // s->saveLoadEntries(&vm.nest[i],nestedScriptEntries);
- // debug(1, "6) At position %d", ftell(inout));
- // for (i=0; i<6; i++)
- // s->saveLoadEntries(&sentence[i],sentenceTabEntries);
- // debug(1, "7) At position %d", ftell(inout));
- // for (i=0; i<6; i++)
- // s->saveLoadEntries(&string[i],stringTabEntries);
- // debug(1, "8) At position %d", ftell(inout));
- // for (i=0; i<16; i++)
- // s->saveLoadEntries(&_colorCycle[i],colorCycleEntries);
- // debug(1, "9) At position %d", ftell(inout));
-
for (i=1; i<=16; i++)
if (res.mode[i]==0)
--- 406,409 ----
***************
*** 442,445 ****
--- 415,435 ----
s->saveLoadArrayOf(_vars, _numVariables, sizeof(_vars[0]), sleInt16);
s->saveLoadArrayOf(_bitVars, _numBitVariables>>3, 1, sleByte);
+
+ /* Save or load a list of the locked objects */
+ if (s->isSaving()) {
+ for (i=1; i<=16; i++)
+ for(j=1; j<res.num[i]; j++) {
+ if (res.flags[i][j]&0x80) {
+ s->saveByte(i);
+ s->saveWord(j);
+ }
+ }
+ s->saveByte(0xFF);
+ } else {
+ int r;
+ while ((r = s->loadByte()) != 0xFF) {
+ res.flags[r][s->loadWord()] |= 0x80;
+ }
+ }
}
***************
*** 447,450 ****
--- 437,441 ----
byte *ptr;
uint32 size,sizele;
+ byte flag;
/* don't save/load these resource types */
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** resource.cpp 2001/11/06 21:41:56 1.12
--- resource.cpp 2001/11/07 18:10:51 1.13
***************
*** 660,664 ****
res.flags[type][i] |= 0x80;
! debug(9, "locking %d,%d", type, i);
}
--- 660,664 ----
res.flags[type][i] |= 0x80;
! // debug(1, "locking %d,%d", type, i);
}
***************
*** 667,671 ****
res.flags[type][i] &= ~0x80;
! debug(9, "unlocking %d,%d", type, i);
}
--- 667,671 ----
res.flags[type][i] &= ~0x80;
! // debug(1, "unlocking %d,%d", type, i);
}
***************
*** 700,705 ****
}
- #define EXPIRE_FREQ 40
-
void Scumm::expireResources(uint32 size) {
int i,j;
--- 700,703 ----
***************
*** 740,743 ****
--- 738,743 ----
} while (size + _allocatedSize > _minHeapThreshold);
+ increaseResourceCounter();
+
debug(1, "Expired resources, mem %d -> %d", oldAllocatedSize, _allocatedSize);
}
***************
*** 786,790 ****
void Scumm::resourceStats() {
! printf("Total allocated size=%d\n", _allocatedSize);
}
--- 786,803 ----
void Scumm::resourceStats() {
! int i,j;
! uint32 lockedSize = 0, lockedNum = 0;
! byte flag;
!
! for (i=1; i<=16; i++)
! for(j=res.num[i]; --j>=0;) {
! flag = res.flags[i][j];
! if (flag&0x80 && res.address[i][j]) {
! lockedSize += ((ResHeader*)res.address[i][j])->size;
! lockedNum++;
! }
! }
!
! printf("Total allocated size=%d, locked=%d(%d)\n", _allocatedSize, lockedSize, lockedNum);
}
***************
*** 794,798 ****
}
-
void Scumm::unkHeapProc2(int a, int b) {
warning("unkHeapProc2: not implemented");
--- 807,810 ----
***************
*** 800,804 ****
void Scumm::loadFlObject(int a, int b) {
! debug(9, "loadFlObject(%d,%d):not implemented", a, b);
}
--- 812,816 ----
void Scumm::loadFlObject(int a, int b) {
! warning("loadFlObject(%d,%d):not implemented", a, b);
}
***************
*** 820,831 ****
_numGlobalObjects = fileReadWordLE();
! allocResTypeData(3, MKID('COST'), _numCostumes, "costume", 1);
! allocResTypeData(1, MKID('ROOM'), _numRooms, "room", 1);
! allocResTypeData(4, MKID('SOUN'), _numSounds, "sound", 1);
! allocResTypeData(2, MKID('SCRP'), _numScripts, "script", 1);
! allocResTypeData(6, MKID('CHAR'), _numCharsets, "charset", 1);
- allocResTypeData(16, MKID('NONE'),50,"new name", 0);
-
allocateArrays();
--- 832,842 ----
_numGlobalObjects = fileReadWordLE();
! allocResTypeData(rtCostume, MKID('COST'), _numCostumes, "costume", 1);
! 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'),50,"new name", 0);
allocateArrays();
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** object.cpp 2001/11/06 21:41:56 1.11
--- object.cpp 2001/11/07 18:10:51 1.12
***************
*** 86,90 ****
int i;
! assert(object>=0 && object < _numGlobalObjects);
if ((_objectFlagTable[object]&0xF)!=0xF) {
--- 86,91 ----
int i;
! if (object >= _numGlobalObjects)
! return -1;
if ((_objectFlagTable[object]&0xF)!=0xF) {
***************
*** 794,798 ****
size = READ_BE_UINT32(&cdhd->size);
! if (size > 1000)
error("setCursorImg: Cursor image too large");
--- 795,799 ----
size = READ_BE_UINT32(&cdhd->size);
! if (size > sizeof(_grabbedCursor))
error("setCursorImg: Cursor image too large");
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** gfx.cpp 2001/11/06 21:29:23 1.13
--- gfx.cpp 2001/11/07 18:10:51 1.14
***************
*** 742,747 ****
int Scumm::hasCharsetMask(int x, int y, int x2, int y2) {
! if (!charset._hasMask || y > string[0].mask_bottom || x > string[0].mask_right ||
! y2 < string[0].mask_top || x2 < string[0].mask_left )
return 0;
return 1;
--- 742,747 ----
int Scumm::hasCharsetMask(int x, int y, int x2, int y2) {
! if (!charset._hasMask || y > gdi._mask_bottom || x > gdi._mask_right ||
! y2 < gdi._mask_top || x2 < gdi._mask_left )
return 0;
return 1;
***************
*** 1171,1184 ****
void Scumm::restoreCharsetBg() {
_bkColor = 0;
! if (string[0].mask_left != -1) {
! restoreBG(string[0].mask_left, string[0].mask_top, string[0].mask_right, string[0].mask_bottom);
charset._hasMask = false;
! string[0].mask_left = -1;
charset._strLeft = -1;
charset._left = -1;
}
! string[0].xpos2 = string[0].xpos;
! string[0].ypos2 = string[0].ypos;
}
--- 1171,1184 ----
void Scumm::restoreCharsetBg() {
_bkColor = 0;
! if (gdi._mask_left != -1) {
! restoreBG(gdi._mask_left, gdi._mask_top, gdi._mask_right, gdi._mask_bottom);
charset._hasMask = false;
! gdi._mask_left = -1;
charset._strLeft = -1;
charset._left = -1;
}
! charset._xpos2 = string[0].xpos;
! charset._ypos2 = string[0].ypos;
}
Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/debug.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** debug.cpp 2001/11/06 20:07:42 1.5
--- debug.cpp 2001/11/07 18:10:52 1.6
***************
*** 31,34 ****
--- 31,35 ----
CMD_ACTOR,
CMD_SCRIPTS,
+ CMD_EXIT
};
***************
*** 49,58 ****
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"
! "actor [actornum] -> show actor information\n"
! "scripts -> show running scripts\n"
);
return true;
--- 50,61 ----
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"
! "(s)cripts -> show running scripts\n"
! "(e)xit -> exit game\n"
);
return true;
***************
*** 77,81 ****
--- 80,87 ----
printScripts();
return true;
+ case CMD_EXIT:
+ exit(1);
}
+ /* this line is never reached */
}
***************
*** 115,118 ****
--- 121,125 ----
{ "a", 1, CMD_ACTOR },
{ "s", 1, CMD_SCRIPTS },
+ { "e", 1, CMD_EXIT },
{ 0, 0, 0 },
};
***************
*** 156,164 ****
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<13; i++) {
a = &_s->actor[i];
if (a->visible)
--- 163,171 ----
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<13; i++) {
! if (act==-1 || act==i) {
a = &_s->actor[i];
if (a->visible)
***************
*** 166,171 ****
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");
}
}
--- 173,178 ----
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");
}
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** actor.cpp 2001/11/06 20:00:47 1.9
--- actor.cpp 2001/11/07 18:10:52 1.10
***************
*** 35,40 ****
a->elevation = 0;
! a->width = 0x18;
! a->talkColor = 0xF;
a->new_2 = 0;
a->new_1 = -80;
--- 35,40 ----
a->elevation = 0;
! a->width = 24;
! a->talkColor = 15;
a->new_2 = 0;
a->new_1 = -80;
More information about the Scummvm-git-logs
mailing list