[Scummvm-cvs-logs] CVS: scummvm/sword1 animation.cpp,1.10.2.5,1.10.2.6 animation.h,1.5.2.2,1.5.2.3 screen.h,1.16,1.16.2.1
James Brown
ender at users.sourceforge.net
Sun Mar 14 05:59:59 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm Info.plist,1.13.2.6,1.13.2.7 NEWS,1.54.2.2,1.54.2.3 README,1.256.2.2,1.256.2.3 scummvm.rc,1.14.2.2,1.14.2.3
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword2/driver animation.cpp,1.21.2.6,1.21.2.7 animation.h,1.18.2.3,1.18.2.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3406/sword1
Modified Files:
Tag: branch-0-6-0
animation.cpp animation.h screen.h
Log Message:
Rebuild BS lookup tables on screen change events. Switch .pal format to binary, and use File class.
Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/animation.cpp,v
retrieving revision 1.10.2.5
retrieving revision 1.10.2.6
diff -u -d -r1.10.2.5 -r1.10.2.6
--- animation.cpp 4 Mar 2004 18:56:39 -0000 1.10.2.5
+++ animation.cpp 14 Mar 2004 13:50:38 -0000 1.10.2.6
@@ -63,44 +63,41 @@
uint i, p;
// Load lookup palettes
- // TODO: Binary format so we can use File class
sprintf(tempFile, "%s.pal", basename);
- FILE *f = fopen(tempFile, "r");
+ File f;
- if (!f) {
+ if (!f.open(tempFile)) {
warning("Cutscene: %s.pal palette missing", basename);
return false;
}
p = 0;
- while (!feof(f)) {
- int end, cnt;
+ while (1) {
+ int end = f.readUint16LE();
+ int cnt = f.readUint16LE();
- if (fscanf(f, "%i %i", &end, &cnt) != 2)
+ if (f.ioFailed())
break;
- palettes[p].end = (uint) end;
- palettes[p].cnt = (uint) cnt;
-
- for (i = 0; i < palettes[p].cnt; i++) {
- int r, g, b;
- fscanf(f, "%i", &r);
- fscanf(f, "%i", &g);
- fscanf(f, "%i", &b);
- palettes[p].pal[4 * i] = r;
- palettes[p].pal[4 * i + 1] = g;
- palettes[p].pal[4 * i + 2] = b;
+ for (i = 0; i < cnt; i++) {
+ palettes[p].pal[4 * i] = f.readByte();
+ palettes[p].pal[4 * i + 1] = f.readByte();
+ palettes[p].pal[4 * i + 2] = f.readByte();
palettes[p].pal[4 * i + 3] = 0;
}
+
for (; i < 256; i++) {
palettes[p].pal[4 * i] = 0;
palettes[p].pal[4 * i + 1] = 0;
palettes[p].pal[4 * i + 2] = 0;
palettes[p].pal[4 * i + 3] = 0;
}
+ palettes[p].end = end;
+ palettes[p].cnt = cnt;
+
p++;
}
- fclose(f);
+ f.close();
palnum = 0;
maxPalnum = p;
@@ -234,6 +231,15 @@
NewGuiColor *AnimationState::lookup = 0;
+void AnimationState::invalidateLookup() {
+ // The screen has changed; the lookup table may be obsolete
+ // TODO: Add heuristic to determine if the table really needs to be
+ // rebuilt.
+ free(lookup);
+ lookup = 0;
+ buildLookup();
+}
+
void AnimationState::buildLookup() {
if (lookup)
return;
@@ -403,16 +409,27 @@
#ifndef BACKEND_8BIT
_sys->update_screen();
#endif
- // FIXME: check for ESC and abbort animation be just returning from the function
+ // FIXME: check for ESC and abort animation be just returning from the function
OSystem::Event event;
while (_sys->poll_event(&event)) {
- if ((event.event_code == OSystem::EVENT_KEYDOWN) &&
- (event.kbd.keycode == 27)) {
- delete anim;
- return;
- }
- if (event.event_code == OSystem::EVENT_QUIT)
+ switch (event.event_code) {
+#ifndef BACKEND_8BIT
+ case OSystem::EVENT_SCREEN_CHANGED:
+ anim->invalidateLookup();
+ break;
+#endif
+ case OSystem::EVENT_KEYDOWN:
+ if (event.kbd.keycode == 27) {
+ delete anim;
+ return;
+ }
+ break;
+ case OSystem::EVENT_QUIT:
_sys->quit();
+ break;
+ default:
+ break;
+ }
}
}
}
Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/animation.h,v
retrieving revision 1.5.2.2
retrieving revision 1.5.2.3
diff -u -d -r1.5.2.2 -r1.5.2.3
--- animation.h 4 Mar 2004 18:56:39 -0000 1.5.2.2
+++ animation.h 14 Mar 2004 13:50:38 -0000 1.5.2.3
@@ -124,6 +124,10 @@
bool init(const char *name);
bool decodeFrame();
+#ifndef BACKEND_8BIT
+ void invalidateLookup(void);
+#endif
+
private:
#ifdef BACKEND_8BIT
Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.h,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -d -r1.16 -r1.16.2.1
--- screen.h 18 Jan 2004 05:52:04 -0000 1.16
+++ screen.h 14 Mar 2004 13:50:38 -0000 1.16.2.1
@@ -21,7 +21,6 @@
#ifndef BSSCREEN_H
#define BSSCREEN_H
-
#include "sworddefs.h"
class OSystem;
- Previous message: [Scummvm-cvs-logs] CVS: scummvm Info.plist,1.13.2.6,1.13.2.7 NEWS,1.54.2.2,1.54.2.3 README,1.256.2.2,1.256.2.3 scummvm.rc,1.14.2.2,1.14.2.3
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword2/driver animation.cpp,1.21.2.6,1.21.2.7 animation.h,1.18.2.3,1.18.2.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list