diff -ur --exclude=CVS ScummVM-0.6.0/sword1/animation.cpp ScummVM-0.6.0+hack/sword1/animation.cpp
old
|
new
|
|
63 | 63 | uint i, p; |
64 | 64 | |
65 | 65 | // Load lookup palettes |
66 | | // TODO: Binary format so we can use File class |
67 | 66 | sprintf(tempFile, "%s.pal", basename); |
68 | | FILE *f = fopen(tempFile, "r"); |
| 67 | FILE f; |
69 | 68 | |
70 | | if (!f) { |
| 69 | if (!f.open(tempFile)) { |
71 | 70 | warning("Cutscene: %s.pal palette missing", basename); |
72 | 71 | return false; |
73 | 72 | } |
74 | 73 | |
75 | 74 | p = 0; |
76 | | while (!feof(f)) { |
77 | | int end, cnt; |
78 | | |
| 75 | while (1) { |
79 | 76 | if (fscanf(f, "%i %i", &end, &cnt) != 2) |
80 | 77 | break; |
81 | 78 | |
82 | | palettes[p].end = (uint) end; |
83 | | palettes[p].cnt = (uint) cnt; |
| 79 | palettes[p].end = f.readUint16LE(); |
| 80 | palettes[p].cnt = f.readUint16LE(); |
| 81 | |
| 82 | if (f.ioFailed()) |
| 83 | break; |
84 | 84 | |
85 | 85 | for (i = 0; i < palettes[p].cnt; i++) { |
86 | | int r, g, b; |
87 | | fscanf(f, "%i", &r); |
88 | | fscanf(f, "%i", &g); |
89 | | fscanf(f, "%i", &b); |
90 | | palettes[p].pal[4 * i] = r; |
91 | | palettes[p].pal[4 * i + 1] = g; |
92 | | palettes[p].pal[4 * i + 2] = b; |
| 86 | palettes[p].pal[4 * i] = f.readByte(); |
| 87 | palettes[p].pal[4 * i + 1] = f.readByte(); |
| 88 | palettes[p].pal[4 * i + 2] = f.readByte(); |
93 | 89 | palettes[p].pal[4 * i + 3] = 0; |
94 | 90 | } |
95 | 91 | for (; i < 256; i++) { |
… |
… |
|
100 | 96 | } |
101 | 97 | p++; |
102 | 98 | } |
103 | | fclose(f); |
| 99 | f.close(); |
104 | 100 | |
105 | 101 | palnum = 0; |
106 | 102 | maxPalnum = p; |
diff -ur --exclude=CVS ScummVM-0.6.0/sword2/driver/animation.cpp ScummVM-0.6.0+hack/sword2/driver/animation.cpp
old
|
new
|
|
69 | 69 | uint i, p; |
70 | 70 | |
71 | 71 | // Load lookup palettes |
72 | | // TODO: Binary format so we can use File class |
73 | | sprintf(tempFile, "%s/%s.pal", _vm->getGameDataPath(), name); |
74 | | FILE *f = fopen(tempFile, "r"); |
| 72 | File f; |
75 | 73 | |
76 | | if (!f) { |
| 74 | sprintf(tempFile, "%s.pal", name); |
| 75 | if (!f.open(tempFile)) { |
77 | 76 | warning("Cutscene: %s.pal palette missing", name); |
78 | 77 | return false; |
79 | 78 | } |
80 | 79 | |
81 | 80 | p = 0; |
82 | | while (!feof(f)) { |
83 | | int end, cnt; |
| 81 | while (1) { |
| 82 | palettes[p].end = f.readUint16LE(); |
| 83 | palettes[p].cnt = f.readUint16LE(); |
84 | 84 | |
85 | | if (fscanf(f, "%i %i", &end, &cnt) != 2) |
| 85 | if (f.ioFailed()) |
86 | 86 | break; |
87 | 87 | |
88 | | palettes[p].end = (uint) end; |
89 | | palettes[p].cnt = (uint) cnt; |
90 | | |
91 | 88 | for (i = 0; i < palettes[p].cnt; i++) { |
92 | | int r, g, b; |
93 | | fscanf(f, "%i", &r); |
94 | | fscanf(f, "%i", &g); |
95 | | fscanf(f, "%i", &b); |
96 | | palettes[p].pal[4 * i] = r; |
97 | | palettes[p].pal[4 * i + 1] = g; |
98 | | palettes[p].pal[4 * i + 2] = b; |
| 89 | palettes[p].pal[4 * i] = f.readByte(); |
| 90 | palettes[p].pal[4 * i + 1] = f.readByte(); |
| 91 | palettes[p].pal[4 * i + 2] = f.readByte(); |
99 | 92 | palettes[p].pal[4 * i + 3] = 0; |
100 | 93 | } |
101 | 94 | for (; i < 256; i++) { |
… |
… |
|
106 | 99 | } |
107 | 100 | p++; |
108 | 101 | } |
109 | | fclose(f); |
| 102 | f.close(); |
110 | 103 | |
111 | 104 | palnum = 0; |
112 | 105 | maxPalnum = p; |