CHEWY: Move globals to Globals

This commit is contained in:
Paul Gilbert 2022-02-13 17:22:54 -08:00
parent 096b125379
commit 546cb99e0b
16 changed files with 103 additions and 119 deletions

View File

@ -266,7 +266,7 @@ enter:
if (mode[LOAD]) {
tmp = fnames + ((text_off + active_slot) * 40);
if (tmp[0]) {
CurrentSong = -1;
_G(currentSong) = -1;
_G(iog)->load(text_off + active_slot, ioptr.save_path);
key = Common::KEYCODE_ESCAPE;
}

View File

@ -39,8 +39,8 @@ int MainMenu::_personAni[3];
void MainMenu::execute() {
// Convenience during testing to not keep showing title sequence
if (!ConfMan.getBool("skip_title")) {
_G(mem)->file->select_pool_item(music_handle, EndOfPool - 17);
_G(mem)->file->load_tmf(music_handle, (tmf_header *)Ci.MusicSlot);
_G(mem)->file->select_pool_item(_G(music_handle), _G(EndOfPool) - 17);
_G(mem)->file->load_tmf(_G(music_handle), (tmf_header *)Ci.MusicSlot);
if (!_G(modul))
_G(sndPlayer)->playMod((tmf_header *)Ci.MusicSlot);
@ -69,7 +69,7 @@ void MainMenu::execute() {
_G(spieler).PersonRoomNr[P_CHEWY] = 98;
room->load_room(&room_blk, 98, &_G(spieler));
CurrentSong = -1;
_G(currentSong) = -1;
load_room_music(98);
fx->border(_G(workpage), 100, 0, 0);
@ -238,7 +238,7 @@ bool MainMenu::loadGame() {
_G(cur)->move(152, 92);
minfo.x = 152;
minfo.y = 92;
savegameFlag = true;
_G(savegameFlag) = true;
int result = Dialogs::Files::execute(false);
cursor_wahl((_G(spieler).inv_cur && _G(spieler).AkInvent != -1 &&

View File

@ -184,7 +184,7 @@ void Options::execute(taf_info *ti) {
_G(sndPlayer)->stopMod();
} else {
_G(spieler).MusicSwitch = true;
CurrentSong = -1;
_G(currentSong) = -1;
load_room_music(_G(spieler).PersonRoomNr[P_CHEWY]);
}
break;

View File

@ -114,8 +114,6 @@ Atdsys *atds;
Flic *flc;
MovClass *mov;
char backged[] = { EPISODE1_GEP };
AutoMov auto_mov[MAX_AUTO_MOV];
int16 HowardMov;
@ -137,27 +135,4 @@ int16 PersonAni[MAX_PERSON];
taf_seq_info *PersonTaf[MAX_PERSON];
uint8 PersonSpr[MAX_PERSON][8];
int16 talk_start_ani = -1;
int16 talk_hide_static = -1;
SplitStringInit ssi[AAD_MAX_PERSON] = {
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
};
int16 frequenz;
int16 CurrentSong = -1;
bool savegameFlag;
Stream *music_handle;
int16 EndOfPool;
int timer_action_ctr;
} // namespace Chewy

View File

@ -166,6 +166,28 @@ public:
int16 _person_tmp_hide[MAX_PERSON] = { 0 };
int16 _person_tmp_room[MAX_PERSON] = { 0 };
SplitStringInit _ssi[AAD_MAX_PERSON] = {
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
{ 0, 100, 0, 200, 4, SPLIT_MITTE, 8, 8},
};
int16 _talk_start_ani = -1;
int16 _talk_hide_static = -1;
int16 _frequenz = 0;
int16 _currentSong = -1;
bool _savegameFlag = false;
Stream *_music_handle = nullptr;
int16 _EndOfPool = 0;
int _timer_action_ctr = 0;
// main.cpp
int16 _menu_flag = 0;
bool _inv_disp_ok = 0;
@ -228,11 +250,6 @@ extern Globals *g_globals;
extern char *invent_txt;
extern char *invent_name;
extern SplitStringInit ssi[AAD_MAX_PERSON];
extern int16 talk_start_ani;
extern int16 talk_hide_static;
extern int16 ak_invent;
extern SprInfo spr_info[MAX_PROG_ANI];
@ -282,7 +299,6 @@ extern Atdsys *atds;
extern Flic *flc;
extern MovClass *mov;
extern char backged[];
extern AutoMov auto_mov[MAX_AUTO_MOV];
extern int16 HowardMov;
extern int16 AkChewyTaf;
@ -302,13 +318,6 @@ extern int16 spz_delay[MAX_PERSON];
extern int16 spz_p_nr;
extern int16 spz_ani[MAX_PERSON];
extern int16 frequenz;
extern Stream *music_handle;
extern int16 EndOfPool;
extern int16 CurrentSong;
extern bool savegameFlag;
extern int timer_action_ctr;
void cursor_wahl(int16 nr);
void hide_cur();

View File

@ -167,13 +167,13 @@ void var_init() {
init_atds();
_G(spieler).FramesPerSecond = 7;
_G(spieler).DisplayText = true;
CurrentSong = -1;
_G(currentSong) = -1;
_G(SetUpScreenFunc) = nullptr;
_G(pfeil_delay) = 0;
_G(pfeil_ani) = 0;
timer_action_ctr = 0;
_G(timer_action_ctr) = 0;
flags.CursorStatus = true;
savegameFlag = false;
_G(savegameFlag) = false;
}
void init_room() {
@ -188,7 +188,7 @@ void init_room() {
room_blk.AtsLoad = true;
strcpy(room_blk.RoomDir, "room/");
room->open_handle(&backged[0], "rb", R_GEPDATEI);
room->open_handle(EPISODE1_GEP, "rb", R_GEPDATEI);
}
void init_atds() {
@ -219,7 +219,7 @@ void init_atds() {
spieler_vector[P_CHEWY].Delay = _G(spieler).DelaySpeed;
atds->set_delay(&_G(spieler).DelaySpeed, _G(spieler).AadSilent);
for (int16 i = 0; i < AAD_MAX_PERSON; i++)
atds->set_split_win(i, &ssi[i]);
atds->set_split_win(i, &_G(ssi)[i]);
atds->set_string_end_func(&atds_string_start);
}
@ -371,7 +371,7 @@ void set_speed() {
void sound_init() {
_G(spieler).SoundSwitch = false;
_G(spieler).MusicSwitch = false;
frequenz = 22050;
_G(frequenz) = 22050;
_G(sndPlayer)->initMixMode();
_G(spieler).MusicVol = 63;
@ -379,18 +379,18 @@ void sound_init() {
_G(sndPlayer)->setMusicMasterVol(_G(spieler).MusicVol);
_G(sndPlayer)->setSoundMasterVol(_G(spieler).SoundVol);
music_handle = room->open_handle(DETAIL_TVP, "rb", R_VOCDATEI);
_G(music_handle) = room->open_handle(DETAIL_TVP, "rb", R_VOCDATEI);
Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(music_handle);
Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(_G(music_handle));
assert(rs);
rs->seek(0);
EndOfPool = 0;
_G(EndOfPool) = 0;
NewPhead Nph;
if (!Nph.load(rs)) {
error("sound_init error");
} else {
EndOfPool = Nph.PoolAnz - 1;
_G(EndOfPool) = Nph.PoolAnz - 1;
}
atds->setHasSpeech(true);

View File

@ -36,7 +36,7 @@ void load_room_music(int16 room_nr) {
int16 volume = _G(spieler).MusicVol;
const int16 lp_mode = 1;
const int16 play_mode = NORMAL_PLAY;
if (_G(spieler).MusicSwitch && (music_handle)) {
if (_G(spieler).MusicSwitch && (_G(music_handle))) {
switch (room_nr) {
case 0:
ttp_index = 0;
@ -176,7 +176,7 @@ void load_room_music(int16 room_nr) {
default:
ttp_index = -1;
CurrentSong = -1;
_G(currentSong) = -1;
_G(sndPlayer)->stopMod();
break;
}
@ -187,13 +187,13 @@ void load_room_music(int16 room_nr) {
volume = _G(spieler).MusicVol;
_G(sndPlayer)->setMusicMasterVol(volume);
_G(sndPlayer)->setLoopMode(lp_mode);
if (ttp_index != CurrentSong) {
if (ttp_index != _G(currentSong)) {
_G(sndPlayer)->stopMod();
while (_G(sndPlayer)->musicPlaying());
memset(Ci.MusicSlot, 0, MUSIC_SLOT_SIZE);
_G(mem)->file->select_pool_item(music_handle, EndOfPool - ttp_index);
_G(mem)->file->load_tmf(music_handle, (tmf_header *)Ci.MusicSlot);
CurrentSong = ttp_index;
_G(mem)->file->select_pool_item(_G(music_handle), _G(EndOfPool) - ttp_index);
_G(mem)->file->load_tmf(_G(music_handle), (tmf_header *)Ci.MusicSlot);
_G(currentSong) = ttp_index;
if (!_G(modul)) {
if (play_mode == NORMAL_PLAY)
_G(sndPlayer)->playMod((tmf_header *)Ci.MusicSlot);

View File

@ -315,10 +315,10 @@ void ads_menu() {
_G(ads_item_ptr) = atds->ads_item_ptr(_G(ads_blk_nr),
&_G(ads_item_anz));
}
det->stop_detail(talk_start_ani);
det->show_static_spr(talk_hide_static);
talk_start_ani = -1;
talk_hide_static = -1;
det->stop_detail(_G(talk_start_ani));
det->show_static_spr(_G(talk_hide_static));
_G(talk_start_ani) = -1;
_G(talk_hide_static) = -1;
if (flags.AdsDialog == false) {
atds->save_ads_header(_G(ads_dia_nr));
}

View File

@ -935,7 +935,7 @@ void flic_cut(int16 nr, int16 mode) {
case FCUT_001:
case 1000:
_G(sndPlayer)->stopMod();
CurrentSong = -1;
_G(currentSong) = -1;
g_engine->playVideo(nr);
break;
@ -951,7 +951,7 @@ void flic_cut(int16 nr, int16 mode) {
case FCUT_019_10:
case FCUT_019_11:
_G(sndPlayer)->stopMod();
CurrentSong = -1;
_G(currentSong) = -1;
nr = FCUT_019_01;
_G(sndPlayer)->setLoopMode(1);
@ -985,7 +985,7 @@ void flic_cut(int16 nr, int16 mode) {
case FCUT_034:
_G(sndPlayer)->stopMod();
CurrentSong = -1;
_G(currentSong) = -1;
do {
#ifndef NEW_VIDEO_CODE
@ -1045,17 +1045,17 @@ void flic_cut(int16 nr, int16 mode) {
case FCUT_065:
_G(sndPlayer)->stopMod();
CurrentSong = -1;
_G(currentSong) = -1;
load_room_music(256);
_G(sndPlayer)->setLoopMode(1);
Room46::kloppe();
_G(sndPlayer)->setLoopMode(_G(spieler).soundLoopMode);
CurrentSong = -1;
_G(currentSong) = -1;
break;
case FCUT_071:
_G(sndPlayer)->stopMod();
CurrentSong = -1;
_G(currentSong) = -1;
g_engine->playVideo(FCUT_071);
break;
@ -1212,7 +1212,7 @@ void flic_cut(int16 nr, int16 mode) {
print_rows(594);
if (FLIC_CUT_1045[i] == 53) {
_G(sndPlayer)->stopMod();
CurrentSong = -1;
_G(currentSong) = -1;
load_room_music(256);
}
@ -1308,7 +1308,7 @@ void flic_cut(int16 nr, int16 mode) {
case 1058:
_G(sndPlayer)->stopMod();
CurrentSong = -1;
_G(currentSong) = -1;
load_room_music(255);
#ifndef NEW_VIDEO_CODE
_G(mem)->file->select_pool_item(Ci.Handle, 58);
@ -1355,7 +1355,7 @@ void flic_cut(int16 nr, int16 mode) {
case 1065:
_G(sndPlayer)->stopMod();
CurrentSong = -1;
_G(currentSong) = -1;
load_room_music(256);
for (i = 0; i < 2 && ret != -1; ++i) {
@ -1548,7 +1548,7 @@ void flic_cut(int16 nr, int16 mode) {
case 1110:
_G(sndPlayer)->stopMod();
CurrentSong = -1;
_G(currentSong) = -1;
load_room_music(257);
_G(sndPlayer)->setMusicMasterVol(20);
#ifndef NEW_VIDEO_CODE

View File

@ -76,12 +76,12 @@ void Room0::entry() {
bool Room0::timer(int16 t_nr, int16 ani_nr) {
switch (ani_nr) {
case 1:
if (timer_action_ctr > 0) {
if (_G(timer_action_ctr) > 0) {
uhr->reset_timer(t_nr, 0);
--timer_action_ctr;
--_G(timer_action_ctr);
} else if (!is_chewy_busy()) {
if (!_G(spieler).R0FueterLab)
timer_action_ctr = 2;
_G(timer_action_ctr) = 2;
flags.AutoAniPlay = true;
if (!_G(spieler).R0SlimeUsed) {

View File

@ -341,8 +341,8 @@ void Room3::probeTransfer() {
if (mouse_auto_obj(SONDE_OBJ, 50, 100)) {
if (minfo.button == 1 || kbinfo.key_code == Common::KEYCODE_RETURN) {
if (is_cur_inventar(SPINAT_INV)) {
ssi[0].X = 120;
ssi[0].Y = 100;
_G(ssi)[0].X = 120;
_G(ssi)[0].Y = 100;
if (_G(spieler).PersonRoomNr[P_CHEWY] == 3)
start_aad(50);

View File

@ -180,7 +180,7 @@ void Room12::bork_ok() {
wait_auto_obj(R12_BORK_OBJ);
det->hide_static_spr(10);
start_detail_wait(4, 1, ANI_VOR);
talk_hide_static = -1;
_G(talk_hide_static) = -1;
det->show_static_spr(12);
atds->set_ats_str(118, TXT_MARK_LOOK, 2, ATS_DATEI);
obj->calc_rsi_flip_flop(SIB_ROEHRE_R12);

View File

@ -145,9 +145,9 @@ int16 Room67::talk_papagei() {
if (_G(menu_item) == CUR_HOWARD) {
show_cur();
ssi[2].X = 270 - _G(spieler).scrollx;
ssi[2].Y = 10;
atds->set_split_win(2, &ssi[2]);
_G(ssi)[2].X = 270 - _G(spieler).scrollx;
_G(ssi)[2].Y = 10;
atds->set_split_win(2, &_G(ssi)[2]);
start_ads_wait(19);
room->set_timer_status(1, TIMER_START);
} else if (_G(menu_item) == CUR_NICHELLE) {
@ -157,9 +157,9 @@ int16 Room67::talk_papagei() {
auto_move(5, P_CHEWY);
show_cur();
ssi[2].X = 270 - _G(spieler).scrollx;
ssi[2].Y = 10;
atds->set_split_win(2, &ssi[2]);
_G(ssi)[2].X = 270 - _G(spieler).scrollx;
_G(ssi)[2].Y = 10;
atds->set_split_win(2, &_G(ssi)[2]);
start_ads_wait(18);
room->set_timer_status(1, TIMER_START);
} else if (_G(menu_item) == CUR_USE) {

View File

@ -226,9 +226,9 @@ void Room68::talk_keeper() {
start_detail_wait(15, 1, ANI_VOR);
det->set_static_ani(16, -1);
show_cur();
ssi[3].X = spieler_vector[P_CHEWY].Xypos[0] - _G(spieler).scrollx + spieler_mi[P_CHEWY].HotX;;
ssi[3].Y = spieler_vector[P_CHEWY].Xypos[1] - _G(spieler).scrolly;
atds->set_split_win(3, &ssi[3]);
_G(ssi)[3].X = spieler_vector[P_CHEWY].Xypos[0] - _G(spieler).scrollx + spieler_mi[P_CHEWY].HotX;;
_G(ssi)[3].Y = spieler_vector[P_CHEWY].Xypos[1] - _G(spieler).scrolly;
atds->set_split_win(3, &_G(ssi)[3]);
start_ads_wait(20);
_G(cur_hide_flag) = false;
hide_cur();
@ -416,7 +416,7 @@ void Room68::kostuem_aad(int16 aad_nr) {
set_person_pos(150, -13, P_NICHELLE, P_RIGHT);
if (_G(spieler).DisplayText) {
CurrentSong = -1;
_G(currentSong) = -1;
load_room_music(_G(spieler).PersonRoomNr[0]);
}
}
@ -428,9 +428,9 @@ void Room68::talk_papagei() {
auto_move(5, P_CHEWY);
show_cur();
ssi[2].X = 60;
ssi[2].Y = 80;
atds->set_split_win(2, &ssi[2]);
_G(ssi)[2].X = 60;
_G(ssi)[2].Y = 80;
atds->set_split_win(2, &_G(ssi)[2]);
start_ads_wait(18);
}

View File

@ -338,8 +338,8 @@ void set_person_pos(int16 x, int16 y, int16 p_nr, int16 richtung) {
if (p_nr >= P_NICHELLE) {
++tmp_nr;
}
ssi[tmp_nr].X = spieler_vector[p_nr].Xypos[0] - _G(spieler).scrollx + spieler_mi[p_nr].HotX;
ssi[tmp_nr].Y = spieler_vector[p_nr].Xypos[1] - _G(spieler).scrolly;
_G(ssi)[tmp_nr].X = spieler_vector[p_nr].Xypos[0] - _G(spieler).scrollx + spieler_mi[p_nr].HotX;
_G(ssi)[tmp_nr].Y = spieler_vector[p_nr].Xypos[1] - _G(spieler).scrolly;
if (!flags.ExitMov) {
if (p_nr == P_CHEWY) {
u_index = ged->ged_idx(x + spieler_mi[p_nr].HotX, y + spieler_mi[p_nr].HotY,
@ -474,8 +474,8 @@ void start_aad_wait(int16 dia_nr, int16 str_nr) {
_G(tmp_maus_links) = _G(maus_links_click);
_G(maus_links_click) = false;
talk_start_ani = -1;
talk_hide_static = -1;
_G(talk_start_ani) = -1;
_G(talk_hide_static) = -1;
set_ssi_xy();
atds->start_aad(dia_nr);
while (atds->aad_get_status() != -1 && !SHOULD_QUIT) {
@ -556,9 +556,9 @@ void aad_wait(int16 str_nr) {
void start_aad(int16 dia_nr, int16 ssi_nr) {
switch (ssi_nr) {
case 0:
ssi[0].X = spieler_vector[P_CHEWY].Xypos[0] - _G(spieler).scrollx + spieler_mi[P_CHEWY].HotX;
ssi[0].Y = spieler_vector[P_CHEWY].Xypos[1] - _G(spieler).scrolly;
atds->set_split_win(0, &ssi[0]);
_G(ssi)[0].X = spieler_vector[P_CHEWY].Xypos[0] - _G(spieler).scrollx + spieler_mi[P_CHEWY].HotX;
_G(ssi)[0].Y = spieler_vector[P_CHEWY].Xypos[1] - _G(spieler).scrolly;
atds->set_split_win(0, &_G(ssi)[0]);
break;
default:

View File

@ -45,8 +45,8 @@ int16 load_ads_dia(int16 dia_nr) {
set_ssi_xy();
_G(ads_dia_nr) = dia_nr;
talk_start_ani = -1;
talk_hide_static = -1;
_G(talk_start_ani) = -1;
_G(talk_hide_static) = -1;
}
}
return ret;
@ -58,9 +58,9 @@ void set_ssi_xy() {
for (int16 i = 0; i < MAX_PERSON; i++) {
if (i >= P_NICHELLE)
tmp = 1;
ssi[i + tmp].X = spieler_vector[i].Xypos[0] - _G(spieler).scrollx + spieler_mi[i].HotX;
ssi[i + tmp].Y = spieler_vector[i].Xypos[1] - _G(spieler).scrolly;
atds->set_split_win(i + tmp, &ssi[i + tmp]);
_G(ssi)[i + tmp].X = spieler_vector[i].Xypos[0] - _G(spieler).scrollx + spieler_mi[i].HotX;
_G(ssi)[i + tmp].Y = spieler_vector[i].Xypos[1] - _G(spieler).scrolly;
atds->set_split_win(i + tmp, &_G(ssi)[i + tmp]);
}
}
@ -1407,13 +1407,13 @@ void atds_string_start(int16 dia_nr, int16 str_nr, int16 person_nr, int16 mode)
switch (person_nr) {
case 1:
if (mode == AAD_STR_START) {
talk_start_ani = 9;
talk_hide_static = 8;
_G(talk_start_ani) = 9;
_G(talk_hide_static) = 8;
} else {
talk_stop_ani = 9;
talk_show_static = 8;
talk_start_ani = -1;
talk_hide_static = -1;
_G(talk_start_ani) = -1;
_G(talk_hide_static) = -1;
}
break;
@ -1425,15 +1425,15 @@ void atds_string_start(int16 dia_nr, int16 str_nr, int16 person_nr, int16 mode)
switch (person_nr) {
case 0:
talk_stop_ani = 9;
talk_start_ani = 10;
_G(talk_start_ani) = 10;
talk_show_static = 13;
talk_hide_static = 12;
_G(talk_hide_static) = 12;
break;
case 1:
talk_start_ani = 9;
_G(talk_start_ani) = 9;
talk_stop_ani = 10;
talk_hide_static = 13;
_G(talk_hide_static) = 13;
talk_show_static = 12;
break;
@ -1454,13 +1454,13 @@ void atds_string_start(int16 dia_nr, int16 str_nr, int16 person_nr, int16 mode)
case 1:
if (mode == AAD_STR_START) {
talk_start_ani = 4;
talk_hide_static = 9;
_G(talk_start_ani) = 4;
_G(talk_hide_static) = 9;
} else {
talk_stop_ani = 4;
talk_show_static = 9;
talk_start_ani = -1;
talk_hide_static = -1;
_G(talk_start_ani) = -1;
_G(talk_hide_static) = -1;
}
break;
@ -2153,9 +2153,9 @@ void atds_string_start(int16 dia_nr, int16 str_nr, int16 person_nr, int16 mode)
}
if (altes_format) {
det->start_detail(talk_start_ani, 255, ANI_VOR);
det->start_detail(_G(talk_start_ani), 255, ANI_VOR);
det->stop_detail(talk_stop_ani);
det->hide_static_spr(talk_hide_static);
det->hide_static_spr(_G(talk_hide_static));
det->show_static_spr(talk_show_static);
} else {
det->start_detail(talk_ani, 255, ANI_VOR);