CHEWY: Remove dead code

Only dialog closeup data (AAD / ADS) is handled by the old code now
This commit is contained in:
Filippos Karapetis 2022-07-10 21:01:22 +03:00
parent 11ffa1922f
commit 411fb9ffd9
8 changed files with 11 additions and 34 deletions

View File

@ -95,9 +95,6 @@ Atdsys::Atdsys() {
}
Atdsys::~Atdsys() {
delete _atdsHandle;
_atdsHandle = nullptr;
for (int16 i = 0; i < MAX_HANDLE; i++) {
if (_atdsMem[i])
free(_atdsMem[i]);
@ -108,17 +105,8 @@ Atdsys::~Atdsys() {
}
void Atdsys::init() {
_atdsHandle = new Common::File();
_atdsHandle->open(ATDS_TXT);
if (!_atdsHandle->isOpen()) {
error("Error opening %s", ATDS_TXT);
}
set_handle(ATDS_TXT, ATS_DATA, ATS_TAP_OFF, ATS_TAP_MAX);
set_handle(ATDS_TXT, INV_ATS_DATA, INV_TAP_OFF, INV_TAP_MAX);
set_handle(ATDS_TXT, AAD_DATA, AAD_TAP_OFF, AAD_TAP_MAX);
set_handle(ATDS_TXT, DIALOG_CLOSEUP_DATA, ADS_TAP_OFF, ADS_TAP_MAX);
set_handle(ATDS_TXT, INV_USE_DATA, USE_TAP_OFF, USE_TAP_MAX);
set_handle(AAD_DATA, AAD_TAP_OFF, AAD_TAP_MAX);
set_handle(DIALOG_CLOSEUP_DATA, ADS_TAP_OFF, ADS_TAP_MAX);
_G(gameState).AadSilent = 10;
_G(gameState).DelaySpeed = 5;
_G(moveState)[P_CHEWY].Delay = _G(gameState).DelaySpeed;
@ -327,7 +315,9 @@ void Atdsys::set_split_win(int16 nr, int16 x, int16 y) {
_ssi[nr]._y = y;
}
void Atdsys::set_handle(const char *fname, int16 mode, int16 chunkStart, int16 chunkNr) {
void Atdsys::set_handle(int16 mode, int16 chunkStart, int16 chunkNr) {
assert(mode == AAD_DATA || mode == DIALOG_CLOSEUP_DATA);
uint32 size = _text->findLargestChunk(chunkStart, chunkStart + chunkNr);
char *tmp_adr = size ? (char *)MALLOC(size + 3) : nullptr;
@ -338,9 +328,11 @@ void Atdsys::set_handle(const char *fname, int16 mode, int16 chunkStart, int16 c
}
void Atdsys::load_atds(int16 chunkNr, int16 mode) {
assert(mode == AAD_DATA || mode == DIALOG_CLOSEUP_DATA);
char *txt_adr = _atdsMem[mode];
if (_atdsHandle && txt_adr) {
if (txt_adr) {
const uint32 chunkSize = _text->getChunk(chunkNr + _atdsPoolOff[mode])->size;
const uint8 *chunkData = _text->getChunkData(chunkNr + _atdsPoolOff[mode]);
memcpy(txt_adr, chunkData, chunkSize);

View File

@ -37,7 +37,7 @@ namespace Chewy {
#define AAD_STR_END 1
#define AAD_DATA 0
#define ATS_DATA 1
#define DIALOG_CLOSEUP_DATA 2
#define DIALOG_CLOSEUP_DATA 2 // ADS_DATA
#define INV_USE_DATA 4
#define INV_ATS_DATA 6
@ -218,7 +218,7 @@ public:
void str_null2leer(char *strStart, char *strEnd);
void load_atds(int16 chunkNr, int16 mode);
void set_handle(const char *fname, int16 mode, int16 chunkStart, int16 chunkNr);
void set_handle(int16 mode, int16 chunkStart, int16 chunkNr);
bool start_ats(int16 txtNr, int16 txtMode, int16 color, int16 mode, int16 *vocNr);
void stop_ats();
bool atsShown() { return _atsv.shown; }
@ -268,7 +268,6 @@ private:
int16 get_delay(int16 txt_len);
void initItemUseWith();
Common::File *_atdsHandle = nullptr;
char *_atdsMem[MAX_HANDLE] = { nullptr };
int16 _atdsPoolOff[MAX_HANDLE] = { 0 };
AadVar _aadv;

View File

@ -34,10 +34,7 @@ namespace Chewy {
#define USE_TAP_MAX 140
#define ADS_TAP_OFF 0
#define ATS_TAP_OFF ADS_TAP_MAX // 500
#define AAD_TAP_OFF ATS_TAP_OFF+ATS_TAP_MAX // 500 + 100
#define INV_TAP_OFF AAD_TAP_OFF+AAD_TAP_MAX // 500 + 100 + 100
#define USE_TAP_OFF INV_TAP_OFF+INV_TAP_MAX // 500 + 100 + 100 + 140
#define AAD_TAP_OFF ADS_TAP_MAX + ATS_TAP_MAX // 500 + 100
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 200
@ -48,10 +45,6 @@ enum SetupScreenMode {
DO_MAIN_LOOP = 2
};
#define MIN_FAR_MEM 3000000
#define MIN_LOW_MEM 100000
#define SPEECH_HALF_BUF 25000
#define JXDIFF 180
#define JYDIFF 150

View File

@ -144,7 +144,6 @@ void init_room() {
_G(room_blk).Rmo = _G(gameState).room_m_obj;
_G(room_blk).Rsi = _G(gameState).room_s_obj;
_G(room_blk).AadLoad = true;
_G(room_blk).AtsLoad = true;
}
void new_game() {

View File

@ -180,9 +180,6 @@ void Room::loadRoom(RaumBlk *Rb, int16 room_nr, GameState *player) {
del_timer_old_room();
add_timer_new_room();
if (Rb->AtsLoad)
_G(atds)->load_atds(_roomInfo->_roomNr, ATS_DATA);
if (Rb->AadLoad)
_G(atds)->load_atds(_roomInfo->_roomNr, AAD_DATA);
}

View File

@ -61,7 +61,6 @@ struct RaumBlk {
int16 *DetKorrekt;
TafInfo *Fti;
int16 AadLoad;
int16 AtsLoad;
};
struct RaumTimer {

View File

@ -64,7 +64,6 @@ void Room65::xit() {
setPersonPos(_G(r65tmp_ch_x), _G(r65tmp_ch_y), P_CHEWY, -1);
setPersonPos(_G(r65tmp_ho_x), _G(r65tmp_ho_y), P_HOWARD, -1);
_G(room_blk).AadLoad = true;
_G(room_blk).AtsLoad = true;
_G(mouseLeftClick) = false;
}

View File

@ -2750,7 +2750,6 @@ void calc_person_dia(int16 p_nr) {
showCur();
} else {
_G(room_blk).AadLoad = false;
_G(room_blk).AtsLoad = false;
_G(gameState).PersonDiaTmpRoom[p_nr] = _G(gameState)._personRoomNr[P_CHEWY];
save_person_rnr();