Tidied up DoEnergyTile() a bit and lowered the speed of the cinema text scrolling

This commit is contained in:
sirlemonhead 2019-12-03 22:02:17 +00:00 committed by Christoph Oelckers
parent e1dc15d165
commit 0ddfbba8a0

View file

@ -182,35 +182,34 @@ void DoEnergyTile()
{ {
for (j = 0; j < 64; j++) for (j = 0; j < 64; j++)
{ {
if (*c != 96) uint8_t val = *c;
if (val != 96)
{ {
if (*c <= 158) { if (val > 158) {
*ptrW = 96; *ptrW = val - 1;
} }
else { else {
*ptrW = (*c) - 1; *ptrW = 96;
} }
//continue;
} }
else else
{ {
if (menu_RandomBit2()) { if (menu_RandomBit2()) {
*ptrW = *c; *ptrW = *c;
c++;
ptrW++;
continue;
} }
else
char al = *(c + 1); {
char ah = *(c - 1); uint8_t al = *(c + 1);
uint8_t ah = *(c - 1);
if (al <= ah) { if (al <= ah) {
al = ah; al = ah;
} }
char cl = al; uint8_t cl = al;
al = *(c - 66);
al = *(c - 66);
if (cl <= al) { if (cl <= al) {
cl = al; cl = al;
} }
@ -244,18 +243,17 @@ void DoEnergyTile()
if (al <= 159) { if (al <= 159) {
*ptrW = 96; *ptrW = 96;
//continue;
} }
else else
{ {
if (!menu_RandomBit2()) if (!menu_RandomBit2()) {
{
cl--; cl--;
} }
*ptrW = cl; *ptrW = cl;
} }
} }
}
c++; c++;
ptrW++; ptrW++;
@ -267,6 +265,7 @@ void DoEnergyTile()
c = &energytile[67]; c = &energytile[67];
ptrW = energy2; ptrW = energy2;
// copy back to energytile[]
for (i = 0; i < 64; i++) for (i = 0; i < 64; i++)
{ {
memcpy(c, ptrW, 64); memcpy(c, ptrW, 64);
@ -276,13 +275,12 @@ void DoEnergyTile()
ptrW = energy2; ptrW = energy2;
// kEnergy2 is 64 x 64
for (i = 0; i < 4096; i++) for (i = 0; i < 4096; i++)
{ {
if ((*ptrW) == 96) { if (ptrW[i] == 96) {
*ptrW = 255; // -1? ptrW[i] = 255; // -1?
} }
ptrW++;
} }
word_9AB5B--; word_9AB5B--;
@ -296,6 +294,8 @@ void DoEnergyTile()
val *= 2; val *= 2;
val += randSize2; val += randSize2;
assert(val < 4356);
energytile[val] = 175; energytile[val] = 175;
word_9AB5B = 1; word_9AB5B = 1;
} }
@ -1992,7 +1992,7 @@ void DoCinemaText(short nVal)
videoNextPage(); videoNextPage();
// TEMP // TEMP
int time = (int)totalclock + 8; int time = (int)totalclock + 4;
while ((int)totalclock < time) { while ((int)totalclock < time) {
HandleAsync(); HandleAsync();
} }