CHEWY: Remove redundant globals

This commit is contained in:
Filippos Karapetis 2022-06-13 14:34:41 +03:00
parent ff23832042
commit 3e8f07cb88
15 changed files with 38 additions and 41 deletions

View File

@ -157,8 +157,8 @@ void Cinema::execute() {
case Common::KEYCODE_RETURN:
hideCur();
_G(out)->cls();
_G(out)->setPointer(_G(screen0));
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(out)->setPointer((byte *)g_screen->getPixels());
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
flic_cut(CINEMA_FLICS[topIndex + selected]);
_G(fontMgr)->setFont(_G(font6));
@ -181,9 +181,9 @@ void Cinema::execute() {
if (flag) {
flag = false;
_G(out)->setPointer(_G(screen0));
_G(out)->setPointer((byte *)g_screen->getPixels());
_G(room)->set_ak_pal(&_G(room_blk));
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
} else {
_G(out)->copyToScreen();
}

View File

@ -199,9 +199,9 @@ void Credits::execute() {
_G(room)->load_tgp(5, &_G(room_blk), 1, 0, GBOOK);
_G(gameState).scrollx = 0;
_G(gameState).scrolly = 0;
_G(out)->setPointer(_G(screen0));
_G(out)->setPointer((byte *)g_screen->getPixels());
_G(room)->set_ak_pal(&_G(room_blk));
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
for (int i = 0; i < 6; ++i) {
int color = 63 - (6 * i);

View File

@ -60,10 +60,10 @@ bool Files::execute(bool isInGame) {
_G(room)->load_tgp(1, &_G(room_blk), GBOOK_TGP, 0, GBOOK);
_G(out)->setPointer(_G(workptr));
_G(out)->map_spr2screen(_G(ablage)[_G(room_blk).AkAblage], 0, 0);
_G(out)->setPointer(_G(screen0));
_G(out)->setPointer((byte *)g_screen->getPixels());
_G(room)->set_ak_pal(&_G(room_blk));
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
_G(out)->setPointer(_G(workptr));
showCur();
@ -269,7 +269,7 @@ enter:
}
} else if (mode[SAVE]) {
_G(out)->copyToScreen();
_G(out)->setPointer(_G(screen0));
_G(out)->setPointer((byte *)g_screen->getPixels());
char slotName[81];
slotName[0] = '\0';
key = _G(out)->scanxy(70, 68 + (active_slot * 10),

View File

@ -344,9 +344,9 @@ void Inventory::menu() {
_G(cur)->plot_cur();
_G(out)->setPointer(nullptr);
if (menu_flag1 == MENU_DISPLAY) {
_G(fx)->blende1(_G(workptr), _G(screen0), nullptr, 200, 0, 300);
_G(fx)->blende1(_G(workptr), nullptr, 0, 300);
} else if (menu_flag1 == MENU_HIDE)
_G(fx)->blende1(_G(workptr), _G(screen0), nullptr, 200, 1, 300);
_G(fx)->blende1(_G(workptr), nullptr, 1, 300);
menu_flag1 = false;
_G(out)->copyToScreen();
} else {
@ -653,7 +653,7 @@ void Inventory::showDiary() {
_G(out)->copyToScreen();
_G(room)->set_ak_pal(&_G(room_blk));
_G(out)->setPointer(nullptr);
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
while (_G(in)->getSwitchCode() != Common::KEYCODE_ESCAPE) {
g_events->update();
@ -671,7 +671,7 @@ void Inventory::showDiary() {
plot_menu();
_G(out)->setPointer(nullptr);
_G(room)->set_ak_pal(&_G(room_blk));
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
}
} // namespace Dialogs

View File

@ -202,7 +202,7 @@ void MainMenu::startGame() {
bool MainMenu::loadGame() {
_G(flags).SaveMenu = true;
savePersonAni();
_G(out)->setPointer(_G(screen0));
_G(out)->setPointer((byte *)g_screen->getPixels());
_G(fontMgr)->setFont(_G(font6));
cursorChoice(CUR_SAVE);
_G(cur)->move(152, 92);

View File

@ -50,10 +50,10 @@ void Options::execute(TafInfo *ti) {
_G(room)->load_tgp(0, &_G(room_blk), GBOOK_TGP, 0, GBOOK);
_G(out)->setPointer(_G(workptr));
_G(out)->map_spr2screen(_G(ablage)[_G(room_blk).AkAblage], 0, 0);
_G(out)->setPointer(_G(screen0));
_G(out)->setPointer((byte *)g_screen->getPixels());
_G(room)->set_ak_pal(&_G(room_blk));
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
_G(out)->setPointer(_G(workptr));
int16 key = 0;
int16 surimy_ani = SURIMY_START;
@ -252,9 +252,9 @@ void Options::execute(TafInfo *ti) {
_G(room)->load_tgp(1, &_G(room_blk), GBOOK_TGP, 0, GBOOK);
_G(out)->setPointer(_G(workptr));
_G(out)->map_spr2screen(_G(ablage)[_G(room_blk).AkAblage], 0, 0);
_G(out)->setPointer(_G(screen0));
_G(out)->setPointer((byte *)g_screen->getPixels());
_G(room)->set_ak_pal(&_G(room_blk));
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
_G(out)->setPointer(_G(workptr));
}

View File

@ -60,7 +60,8 @@ void Effect::rnd_blende(byte *rnd_speicher, byte *sram_speicher, byte *screen, b
free(sp);
}
void Effect::blende1(byte *memPtr, byte *screen, byte *palette, int16 frames, uint8 mode, int16 color) {
void Effect::blende1(byte *memPtr, byte *palette, uint8 mode, int16 color) {
byte *screen = (byte *)g_screen->getPixels();
byte *sp = (byte *)MALLOC(8 * 8 + 4);
if (color < 256) {
for (int16 i = 0; i < 13; i++) {

View File

@ -39,8 +39,8 @@ public:
Effect();
~Effect();
void blende1(byte *memPtr, byte *screen,
byte *palette, int16 frames, uint8 mode, int16 color);
void blende1(byte *memPtr,
byte *palette, uint8 mode, int16 color);
void border(byte *screen, int16 val1, uint8 mode, int16 color);
void rnd_blende(byte *rnd_speicher, byte *sram_speicher,

View File

@ -119,7 +119,6 @@ public:
const uint8 *_chewy_ph_nr;
const uint8 *_chewy_ph;
byte *_pal = nullptr;
byte *_screen0 = nullptr;
int16 _scr_width = 0;
BlendMode _fx_blend = BLEND_NONE;
void (*_SetUpScreenFunc)() = nullptr;
@ -182,7 +181,6 @@ public:
TafInfo *_menutaf = nullptr;
TafSeqInfo *_howard_taf = nullptr;
TafInfo *_chewy = nullptr;
int16 *_chewy_kor = nullptr;
Barriers *_barriers = nullptr;
Text *_txt = nullptr;
Room *_room = nullptr;

View File

@ -49,7 +49,6 @@ void standard_init() {
_G(out)->init();
_G(out)->cls();
_G(scr_width) = 0;
_G(screen0) = (byte *)g_screen->getPixels();
// WORKAROUND: Moved from init_load because the original
// uses _G(curtaf)->_image below before _G(curtaf) was initialized

View File

@ -78,13 +78,13 @@ void alloc_buffers() {
void free_buffers() {
_G(det)->del_dptr();
for (int16 i = 0; i < MAX_PERSON; i++)
free((char *)_G(PersonTaf)[i]);
free((char *)_G(spz_tinfo));
free(_G(PersonTaf)[i]);
free(_G(spz_tinfo));
free(_G(spblende));
free((char *)_G(menutaf));
free((char *)_G(chewy));
free(_G(menutaf));
free(_G(chewy));
free((char *)_G(curtaf));
free(_G(curtaf));
free(_G(Ci).tempArea);
free(_G(pal));
free(_G(workpage));
@ -268,7 +268,7 @@ bool mainLoop(int16 mode) {
case Common::KEYCODE_F6:
_G(flags).SaveMenu = true;
_G(out)->setPointer(_G(screen0));
_G(out)->setPointer((byte *)g_screen->getPixels());
_G(fontMgr)->setFont(_G(font6));
cursorChoice(CUR_SAVE);
if (Dialogs::Files::execute(true) == 1) {
@ -337,7 +337,7 @@ bool mainLoop(int16 mode) {
g_events->_mousePos.y = 92;
_G(fontMgr)->setFont(_G(font6));
_G(out)->setPointer(_G(screen0));
_G(out)->setPointer((byte *)g_screen->getPixels());
cursorChoice(CUR_SAVE);
bool ret = Dialogs::Files::execute(true);
if (ret) {
@ -577,22 +577,22 @@ void setupScreen(SetupScreenMode mode) {
_G(out)->setPointer(nullptr);
switch (_G(fx_blend)) {
case BLEND1:
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
break;
case BLEND2:
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 1, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 1, 0);
break;
case BLEND3:
_G(fx)->rnd_blende(_G(spblende), _G(workptr), _G(screen0), _G(pal), 0, 10);
_G(fx)->rnd_blende(_G(spblende), _G(workptr), (byte *)g_screen->getPixels(), _G(pal), 0, 10);
break;
case BLEND4:
_G(out)->setPointer(_G(workptr));
_G(out)->cls();
_G(out)->setPointer(nullptr);
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
break;
default:

View File

@ -505,7 +505,6 @@ void load_chewy_taf(int16 taf_nr) {
_G(gameState).ChewyAni = taf_nr;
_G(AkChewyTaf) = taf_nr;
_G(chewy) = _G(mem)->taf_adr(filename);
_G(chewy_kor) = _G(chewy)->correction;
}
}
}

View File

@ -33,7 +33,7 @@ void Room10::entry() {
_G(out)->setPointer(_G(workptr));
_G(out)->map_spr2screen(_G(ablage)[_G(room_blk).AkAblage], _G(gameState).scrollx, _G(gameState).scrolly);
_G(out)->setPointer(nullptr);
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(fx)->blende1(_G(workptr), _G(pal), 0, 0);
_G(gameState).R10Surimy = true;
_G(fx_blend) = BLEND_NONE;
flic_cut(FCUT_003);

View File

@ -156,8 +156,8 @@ void spriteEngine() {
if (!_G(gameState)._personHide[P_CHEWY]) {
if (!_G(spz_ani)[P_CHEWY]) {
int16 sprNr = _G(chewy_ph)[_G(moveState)[P_CHEWY].Phase * 8 + _G(moveState)[P_CHEWY].PhNr];
x = _G(spieler_mi)[P_CHEWY].XyzStart[0] + _G(chewy_kor)[sprNr * 2] - _G(gameState).scrollx;
y = _G(spieler_mi)[P_CHEWY].XyzStart[1] + _G(chewy_kor)[sprNr * 2 + 1] - _G(gameState).scrolly;
x = _G(spieler_mi)[P_CHEWY].XyzStart[0] + _G(chewy)->correction[sprNr * 2] - _G(gameState).scrollx;
y = _G(spieler_mi)[P_CHEWY].XyzStart[1] + _G(chewy)->correction[sprNr * 2 + 1] - _G(gameState).scrolly;
calc_zoom(_G(spieler_mi)[P_CHEWY].XyzStart[1], (int16)_G(room)->_roomInfo->_zoomFactor,
(int16)_G(room)->_roomInfo->_zoomFactor, &_G(moveState)[P_CHEWY]);

View File

@ -255,8 +255,8 @@ bool VideoPlayer::handleCustom(uint num, uint frame, CfoDecoder *cfoDecoder) {
case FCUT_078: {
// Room64::cut_sev
const int16 spr_nr = _G(chewy_ph)[_G(moveState)[P_CHEWY].Phase * 8 + _G(moveState)[P_CHEWY].PhNr];
const int16 x = _G(spieler_mi)[P_CHEWY].XyzStart[0] + _G(chewy_kor)[spr_nr * 2] - scrollx;
const int16 y = _G(spieler_mi)[P_CHEWY].XyzStart[1] + _G(chewy_kor)[spr_nr * 2 + 1] - scrolly;
const int16 x = _G(spieler_mi)[P_CHEWY].XyzStart[0] + _G(chewy)->correction[spr_nr * 2] - scrollx;
const int16 y = _G(spieler_mi)[P_CHEWY].XyzStart[1] + _G(chewy)->correction[spr_nr * 2 + 1] - scrolly;
calc_zoom(_G(spieler_mi)[P_CHEWY].XyzStart[1], (int16)_G(room)->_roomInfo->_zoomFactor, (int16)_G(room)->_roomInfo->_zoomFactor, &_G(moveState)[P_CHEWY]);
_G(out)->scale_set(_G(chewy)->image[spr_nr], x, y, _G(moveState)[P_CHEWY].Xzoom, _G(moveState)[P_CHEWY].Yzoom, _G(scr_width));