Ticket #7907: max_actor_n_resource_patch

File max_actor_n_resource_patch, 9.8 KB (added by SF/japj, 19 years ago)

max actor and max resource patch

Line 
1Index: actor.cpp
2===================================================================
3RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
4retrieving revision 1.10
5diff -u -r1.10 actor.cpp
6--- actor.cpp 2001/11/07 18:10:52 1.10
7+++ actor.cpp 2001/11/10 11:39:25
8@@ -574,7 +574,7 @@
9 int i;
10 Actor *a;
11
12- for (i=1; i<13; i++) {
13+ for (i=1; i<MAX_ACTORS; i++) {
14 a = derefActor(i);
15 if (a->room == _currentRoom)
16 showActor(a);
17@@ -608,7 +608,7 @@
18 void Scumm::walkActors() {
19 int i;
20 Actor *a;
21- for (i=1; i<13; i++) {
22+ for (i=1; i<MAX_ACTORS; i++) {
23 a = derefActor(i);
24 if (a->room==_currentRoom)
25 walkActor(a);
26@@ -620,12 +620,12 @@
27 int i;
28 Actor *a;
29
30- for (i=1; i<13; i++) {
31+ for (i=1; i<MAX_ACTORS; i++) {
32 a = derefActor(i);
33 if (a->cost.animCounter2 && a->room==_currentRoom && a->sound) {
34 _currentScript = 0xFF;
35 addSoundToQueue(a->sound[0]);
36- for (i=1; i<13; i++) {
37+ for (i=1; i<MAX_ACTORS; i++) {
38 a = derefActor(i);
39 a->cost.animCounter2 = 0;
40 }
41@@ -708,10 +708,10 @@
42
43 void Scumm::processActors() {
44 int i;
45- Actor *actors[13],*a,**ac,**ac2,*tmp;
46+ Actor *actors[MAX_ACTORS],*a,**ac,**ac2,*tmp;
47 int numactors = 0, cnt,cnt2;
48
49- for (i=1; i<13; i++) {
50+ for (i=1; i<MAX_ACTORS; i++) {
51 a = derefActor(i);
52 if (a->room == _currentRoom)
53 actors[numactors++] = a;
54@@ -814,7 +814,7 @@
55 for (i=0; i<40; i++) {
56 bits = actorDrawBits[_screenStartStrip+i];
57 if (bits&0x3FFF) {
58- for(j=0; j<13; j++) {
59+ for(j=0; j<MAX_ACTORS; j++) {
60 if ((bits&(1<<j)) && bits!=(1<<j)) {
61 Actor *a = derefActor(j);
62 a->needRedraw = true;
63@@ -832,7 +832,7 @@
64 drawbits = actorDrawBits[x>>3];
65 if (!(drawbits & 0x3FFF))
66 return 0;
67- for (i=1; i<13; i++) {
68+ for (i=1; i<MAX_ACTORS; i++) {
69 Actor *a = derefActor(i);
70 if (drawbits&(1<<i) && !getClass(i, 32) && y >= a->top && y <= a->bottom) {
71 return i;
72@@ -966,7 +966,7 @@
73 Actor *a;
74
75 if (_roomResource!=0)
76- for (i=1; i<13; i++) {
77+ for (i=1; i<MAX_ACTORS; i++) {
78 a = derefActor(i);
79 if (a->room == _currentRoom && a->costume == cost)
80 return true;
81Index: debug.cpp
82===================================================================
83RCS file: /cvsroot/scummvm/scummvm/debug.cpp,v
84retrieving revision 1.6
85diff -u -r1.6 debug.cpp
86--- debug.cpp 2001/11/07 18:10:52 1.6
87+++ debug.cpp 2001/11/10 11:39:25
88@@ -165,7 +165,7 @@
89 printf("+--------------------------------------------------------------+\n");
90 printf("|# |room| x y |elev|cos|width|box|mov|zp|frame|scale|spd|dir|\n");
91 printf("+--+----+--------+----+---+-----+---+---+--+-----+-----+---+---+\n");
92- for(i=1; i<13; i++) {
93+ for(i=1; i<MAX_ACTORS; i++) {
94 if (act==-1 || act==i) {
95 a = &_s->actor[i];
96 if (a->visible)
97Index: gfx.cpp
98===================================================================
99RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
100retrieving revision 1.16
101diff -u -r1.16 gfx.cpp
102--- gfx.cpp 2001/11/09 18:54:14 1.16
103+++ gfx.cpp 2001/11/10 11:39:28
104@@ -295,7 +295,7 @@
105 t-_screenStartStrip > cd->_rightTrigger)
106 setCameraAt(a->x);
107
108- for (i=1,a=getFirstActor(); ++a,i<13; i++) {
109+ for (i=1,a=getFirstActor(); ++a,i<MAX_ACTORS; i++) {
110 if (a->room==_currentRoom)
111 a->needRedraw = true;
112 }
113@@ -1632,7 +1632,7 @@
114 }
115 }
116
117- for(i=1,a=getFirstActor(); ++a,i<13; i++) {
118+ for(i=1,a=getFirstActor(); ++a,i<MAX_ACTORS; i++) {
119 a->needBgReset = false;
120 }
121 }
122Index: gui.h
123===================================================================
124RCS file: /cvsroot/scummvm/scummvm/gui.h,v
125retrieving revision 1.1
126diff -u -r1.1 gui.h
127--- gui.h 2001/11/09 18:56:27 1.1
128+++ gui.h 2001/11/10 11:39:28
129@@ -1,3 +1,6 @@
130+#ifndef gui_h
131+#define gui_h
132+
133 enum {
134 GUI_NONE = 0,
135 GUI_TEXT = 1,
136@@ -73,3 +76,5 @@
137 void queryMessage(const char *msg, const char *alts);
138 byte getDefaultColor(int color);
139 };
140+
141+#endif
142\ No newline at end of file
143Index: resource.cpp
144===================================================================
145RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
146retrieving revision 1.16
147diff -u -r1.16 resource.cpp
148--- resource.cpp 2001/11/09 22:45:19 1.16
149+++ resource.cpp 2001/11/10 11:39:29
150@@ -686,7 +686,7 @@
151 int i,j;
152 byte counter;
153
154- for (i=1; i<=16; i++) {
155+ for (i=1; i<rtMaxTypes; i++) {
156 for(j=res.num[i]; --j>=0;) {
157 counter = res.flags[i][j] & 0x7F;
158 if (counter && counter < 0x7F) {
159@@ -717,7 +717,7 @@
160 best_type = 0;
161 best_counter = 2;
162
163- for (i=1; i<=16; i++)
164+ for (i=1; i<rtMaxTypes; i++)
165 if (res.mode[i]) {
166 for(j=res.num[i]; --j>=0;) {
167 flag = res.flags[i][j];
168@@ -741,7 +741,7 @@
169
170 void Scumm::freeResources() {
171 int i,j;
172- for (i=1; i<=16; i++) {
173+ for (i=1; i<rtMaxTypes; i++) {
174 for(j=res.num[i]; --j>=0;) {
175 if (isResourceLoaded(i,j))
176 nukeResource(i,j);
177@@ -786,7 +786,7 @@
178 uint32 lockedSize = 0, lockedNum = 0;
179 byte flag;
180
181- for (i=1; i<=16; i++)
182+ for (i=1; i<rtMaxTypes; i++)
183 for(j=res.num[i]; --j>=0;) {
184 flag = res.flags[i][j];
185 if (flag&0x80 && res.address[i][j]) {
186Index: saveload.cpp
187===================================================================
188RCS file: /cvsroot/scummvm/scummvm/saveload.cpp,v
189retrieving revision 1.12
190diff -u -r1.12 saveload.cpp
191--- saveload.cpp 2001/11/09 22:44:26 1.12
192+++ saveload.cpp 2001/11/10 11:39:31
193@@ -95,7 +95,7 @@
194 memset(_inventory, 0, sizeof(_inventory[0])*_numInventory);
195
196 /* Nuke all resources */
197- for (i=1; i<=16; i++)
198+ for (i=1; i<rtMaxTypes; i++)
199 if (i!=rtTemp && i!=rtBuffer)
200 for(j=0; j<res.num[i]; j++) {
201 nukeResource(i,j);
202@@ -452,7 +452,7 @@
203 s->saveLoadArrayOf(string, 6, sizeof(string[0]), stringTabEntries);
204 s->saveLoadArrayOf(_colorCycle, 16, sizeof(_colorCycle[0]), colorCycleEntries);
205
206- for (i=1; i<=16; i++)
207+ for (i=1; i<rtMaxTypes; i++)
208 if (res.mode[i]==0)
209 for(j=1; j<res.num[i]; j++)
210 saveLoadResource(s,i,j);
211@@ -464,7 +464,7 @@
212
213 /* Save or load a list of the locked objects */
214 if (s->isSaving()) {
215- for (i=1; i<=16; i++)
216+ for (i=1; i<rtMaxTypes; i++)
217 for(j=1; j<res.num[i]; j++) {
218 if (res.flags[i][j]&0x80) {
219 s->saveByte(i);
220Index: script_v2.cpp
221===================================================================
222RCS file: /cvsroot/scummvm/scummvm/script_v2.cpp,v
223retrieving revision 1.7
224diff -u -r1.7 script_v2.cpp
225--- script_v2.cpp 2001/11/07 18:10:51 1.7
226+++ script_v2.cpp 2001/11/10 11:39:33
227@@ -2004,7 +2004,7 @@
228 case 6:
229 _fullRedraw = 1;
230 redrawBGAreas();
231- for (i=0; i<13; i++)
232+ for (i=0; i<MAX_ACTORS; i++)
233 derefActor(i)->needRedraw = true;
234 processActors();
235 screenEffect(args[1]);
236Index: scumm.h
237===================================================================
238RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
239retrieving revision 1.22
240diff -u -r1.22 scumm.h
241--- scumm.h 2001/11/09 18:54:14 1.22
242+++ scumm.h 2001/11/10 11:39:35
243@@ -19,6 +19,9 @@
244 *
245 */
246
247+#ifndef scumm_h
248+#define scumm_h
249+
250 #include "scummsys.h"
251
252 #define SWAP(a,b) do{int tmp=a; a=b; b=tmp; } while(0)
253@@ -29,6 +32,7 @@
254 typedef void (Scumm::*OpcodeProc)();
255
256 #define NUM_SCRIPT_SLOT 25
257+#define MAX_ACTORS 13
258
259 #pragma START_PACK_STRUCTS
260
261@@ -306,6 +310,7 @@
262 rtBox = 15,
263 rtObjectName = 16,
264
265+ rtMaxTypes = 17,
266 };
267
268 #define _maxRooms res.num[rtRoom]
269@@ -759,14 +764,14 @@
270 int16 _palManipCounter;
271
272 struct {
273- byte mode[17];
274- uint16 num[17];
275- uint32 tags[17];
276- const char *name[17];
277- byte **address[17];
278- byte *flags[17];
279- byte *roomno[17];
280- uint32 *roomoffs[17];
281+ byte mode[rtMaxTypes];
282+ uint16 num[rtMaxTypes];
283+ uint32 tags[rtMaxTypes];
284+ const char *name[rtMaxTypes];
285+ byte **address[rtMaxTypes];
286+ byte *flags[rtMaxTypes];
287+ byte *roomno[rtMaxTypes];
288+ uint32 *roomoffs[rtMaxTypes];
289 } res;
290
291 struct {
292@@ -784,7 +789,7 @@
293 int16 x,y;
294 } mouse;
295
296- Actor actor[13];
297+ Actor actor[MAX_ACTORS];
298
299 uint16 actorDrawBits[200];
300
301@@ -1668,4 +1673,6 @@
302 void blit(byte *dst, byte *src, int w, int h);
303 byte *findResource(uint32 id, byte *searchin, int index);
304 void playSfxSound(void *sound, uint32 size, uint rate);
305-bool isSfxFinished();
306\ No newline at end of file
307+bool isSfxFinished();
308+
309+#endif
310\ No newline at end of file
311Index: scummsys.h
312===================================================================
313RCS file: /cvsroot/scummvm/scummvm/scummsys.h,v
314retrieving revision 1.11
315diff -u -r1.11 scummsys.h
316--- scummsys.h 2001/11/07 18:17:20 1.11
317+++ scummsys.h 2001/11/10 11:39:36
318@@ -19,6 +19,9 @@
319 *
320 */
321
322+#ifndef scummsys_h
323+#define scummsys_h
324+
325 #if defined(WIN32)
326
327 /* Pragmas are VC++-specific */
328@@ -200,3 +203,4 @@
329
330 #endif
331
332+#endif
333\ No newline at end of file
334Index: scummvm.cpp
335===================================================================
336RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
337retrieving revision 1.22
338diff -u -r1.22 scummvm.cpp
339--- scummvm.cpp 2001/11/09 18:54:15 1.22
340+++ scummvm.cpp 2001/11/10 11:39:37
341@@ -72,7 +72,7 @@
342 setShake(0);
343 setupCursor();
344
345- for (i=1,a=getFirstActor(); ++a,i<13; i++) {
346+ for (i=1,a=getFirstActor(); ++a,i<MAX_ACTORS; i++) {
347 a->number = i;
348 initActor(a, 1);
349 }
350@@ -287,7 +287,7 @@
351 charset._hasMask = false;
352 redrawVerbs();
353 _fullRedraw = true;
354- for (i=0,a=getFirstActor(); i<13; i++,a++)
355+ for (i=0,a=getFirstActor(); i<MAX_ACTORS; i++,a++)
356 a->needRedraw = 1;
357 }
358
359@@ -484,7 +484,7 @@
360 killScriptsAndResources();
361 stopCycle(0);
362
363- for(i=1,at=getFirstActor(); ++at,i<13; i++) {
364+ for(i=1,at=getFirstActor(); ++at,i<MAX_ACTORS; i++) {
365 if (at->visible)
366 hideActor(at);
367 }
368@@ -836,7 +836,7 @@
369 }
370
371 Actor *Scumm::derefActorSafe(int id, const char *errmsg) {
372- if (id<1 || id>=13)
373+ if (id<1 || id>=MAX_ACTORS)
374 error("Invalid actor %d in %s", id, errmsg);
375 return derefActor(id);
376 }