Skip to content

Commit a1fc68f

Browse files
committed
Review mve palette functions
1 parent 2e15d01 commit a1fc68f

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/movie_lib.cc

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ static void movieUnlockSurfaces();
5555
static void movieSwapSurfaces();
5656
static void _sfShowFrame(int a1, int a2, int a3);
5757
static void _do_nothing_(int a1, int a2, unsigned short* a3);
58-
static void _SetPalette_1(int a1, int a2);
59-
static void _SetPalette_(int a1, int a2);
60-
static void _palMakeSynthPalette(int a1, int a2, int a3, int a4, int a5, int a6);
61-
static void _palLoadPalette(unsigned char* palette, int a2, int a3);
58+
static void palSetPalette(int start, int count);
59+
static void palClrPalette(int start, int count);
60+
static void palMakeSynthPalette(int a1, int a2, int a3, int a4, int a5, int a6);
61+
static void palLoadPalette(unsigned char* palette, int start, int count);
6262
static void _syncRelease();
6363
static void ioRelease();
6464
static void _MVE_sndRelease();
@@ -329,9 +329,6 @@ static int rm_FrameCount;
329329
// 0x6B36AC
330330
static int sf_ScreenHeight;
331331

332-
// 0x6B36B8
333-
static unsigned char _palette_entries1[768];
334-
335332
// 0x6B39B8
336333
static MveMallocFunc* mve_malloc_func;
337334

@@ -390,7 +387,7 @@ static int _mveBW;
390387
static int dword_6B3D00;
391388

392389
// 0x6B3D0C
393-
static unsigned char _pal_tbl[768];
390+
static unsigned char pal_tbl[768];
394391

395392
// 0x6B4016
396393
static unsigned char byte_6B4016;
@@ -793,9 +790,9 @@ int _MVE_rmStepMovie()
793790

794791
v19 = v1[1];
795792
if (v19 == 0 || v21) {
796-
_SetPalette_1(v1[0], v19);
793+
palSetPalette(v1[0], v19);
797794
} else {
798-
_SetPalette_(v1[0], v19);
795+
palClrPalette(v1[0], v19);
799796
}
800797

801798
if (v21) {
@@ -809,7 +806,7 @@ int _MVE_rmStepMovie()
809806

810807
v20 = v1[1];
811808
if (v20 && !v21) {
812-
_SetPalette_1(v1[0], v20);
809+
palSetPalette(v1[0], v20);
813810
}
814811

815812
rm_p = (unsigned char*)v1;
@@ -832,11 +829,11 @@ int _MVE_rmStepMovie()
832829
continue;
833830
case 11:
834831
// some kind of palette rotation
835-
_palMakeSynthPalette(v1[0], v1[1], v1[2], v1[3], v1[4], v1[5]);
832+
palMakeSynthPalette(v1[0], v1[1], v1[2], v1[3], v1[4], v1[5]);
836833
continue;
837834
case 12:
838835
// palette
839-
_palLoadPalette((unsigned char*)v1 + 4, v1[0], v1[1]);
836+
palLoadPalette((unsigned char*)v1 + 4, v1[0], v1[1]);
840837
continue;
841838
case 14:
842839
// save current position
@@ -1463,48 +1460,51 @@ static void _do_nothing_(int a1, int a2, unsigned short* a3)
14631460
}
14641461

14651462
// 0x4F6090
1466-
static void _SetPalette_1(int a1, int a2)
1463+
static void palSetPalette(int start, int count)
14671464
{
14681465
if (!dword_6B4027) {
1469-
pal_SetPalette(_pal_tbl, a1, a2);
1466+
pal_SetPalette(pal_tbl, start, count);
14701467
}
14711468
}
14721469

14731470
// 0x4F60C0
1474-
static void _SetPalette_(int a1, int a2)
1471+
static void palClrPalette(int start, int count)
14751472
{
1473+
unsigned char palette[768];
1474+
14761475
if (!dword_6B4027) {
1477-
pal_SetPalette(_palette_entries1, a1, a2);
1476+
memset(palette, 0, sizeof(palette));
1477+
pal_SetPalette(palette, start, count);
14781478
}
14791479
}
14801480

14811481
// 0x4F60F0
1482-
static void _palMakeSynthPalette(int a1, int a2, int a3, int a4, int a5, int a6)
1482+
static void palMakeSynthPalette(int a1, int a2, int a3, int a4, int a5, int a6)
14831483
{
14841484
int i;
14851485
int j;
14861486

14871487
for (i = 0; i < a2; i++) {
14881488
for (j = 0; j < a3; j++) {
1489-
_pal_tbl[3 * a1 + 3 * j] = (63 * i) / (a2 - 1);
1490-
_pal_tbl[3 * a1 + 3 * j + 1] = 0;
1491-
_pal_tbl[3 * a1 + 3 * j + 2] = 5 * ((63 * j) / (a3 - 1)) / 8;
1489+
pal_tbl[3 * a1 + 3 * j] = (63 * i) / (a2 - 1);
1490+
pal_tbl[3 * a1 + 3 * j + 1] = 0;
1491+
pal_tbl[3 * a1 + 3 * j + 2] = 5 * ((63 * j) / (a3 - 1)) / 8;
14921492
}
14931493
}
14941494

14951495
for (i = 0; i < a5; i++) {
14961496
for (j = 0; j < a6; j++) {
1497-
_pal_tbl[3 * a4 + 3 * j] = 0;
1498-
_pal_tbl[3 * a4 + 3 * j + 1] = (63 * i) / (a5 - 1);
1499-
_pal_tbl[3 * a1 + 3 * j + 2] = 5 * ((63 * j) / (a6 - 1)) / 8;
1497+
pal_tbl[3 * a4 + 3 * j] = 0;
1498+
pal_tbl[3 * a4 + 3 * j + 1] = (63 * i) / (a5 - 1);
1499+
pal_tbl[3 * a1 + 3 * j + 2] = 5 * ((63 * j) / (a6 - 1)) / 8;
15001500
}
15011501
}
15021502
}
15031503

15041504
// 0x4F6210
1505-
static void _palLoadPalette(unsigned char* palette, int a2, int a3)
1505+
static void palLoadPalette(unsigned char* palette, int start, int count)
15061506
{
1507-
memcpy(_pal_tbl + 3 * a2, palette, 3 * a3);
1507+
memcpy(&(pal_tbl[start * 3]), palette, count * 3);
15081508
}
15091509

15101510
// 0x4F6240

0 commit comments

Comments
 (0)