diff --git a/engines/chewy/effect.cpp b/engines/chewy/effect.cpp index 51d878f63fb..9706556b8a7 100644 --- a/engines/chewy/effect.cpp +++ b/engines/chewy/effect.cpp @@ -21,7 +21,6 @@ #include "chewy/ngshext.h" #include "chewy/effect.h" -#include "chewy/defines.h" #include "chewy/global.h" namespace Chewy { @@ -31,17 +30,14 @@ effect::effect() { effect::~effect() { } -void effect::rnd_blende(byte *rnd_speicher, byte *sram_speicher, - byte *screen, byte *palette, int16 col, int16 skip_line) { - int16 *rnd_zeiger; - int16 i, x, y; - byte *sp; - sp = (byte *)MALLOC(8 * 8 + 4); +void effect::rnd_blende(byte *rnd_speicher, byte *sram_speicher, byte *screen, byte *palette, int16 col, int16 skip_line) { + byte *sp = (byte *)MALLOC(8 * 8 + 4); if (!modul) { - rnd_zeiger = (int16 *)rnd_speicher; + int16 *rnd_zeiger = (int16 *)rnd_speicher; if (col < 256) { - for (i = 0; i < 1002; i++) { - y = (rnd_zeiger[i] / 40) * 8; + for (int16 i = 0; i < 1002; i++) { + int16 x; + int16 y = (rnd_zeiger[i] / 40) * 8; if (rnd_zeiger[i] > 39) x = (rnd_zeiger[i] - (40 * (y / 8))) * 8; else @@ -51,8 +47,9 @@ void effect::rnd_blende(byte *rnd_speicher, byte *sram_speicher, } out->set_palette(palette); } - for (i = 0; i < 1000; i++) { - y = (rnd_zeiger[i] / 40) * 8; + for (int16 i = 0; i < 1000; i++) { + int16 x; + int16 y = (rnd_zeiger[i] / 40) * 8; if (rnd_zeiger[i] > 39) x = (rnd_zeiger[i] - (40 * (y / 8))) * 8; else @@ -67,33 +64,29 @@ void effect::rnd_blende(byte *rnd_speicher, byte *sram_speicher, } } -void effect::blende1(byte *sram_speicher, byte *screen, - byte *palette, int16 frames, uint8 mode, int16 col) { - - int16 i; - int16 x, y, x1, y1; - byte *sp; - sp = (byte *)MALLOC(8 * 8 + 4); +void effect::blende1(byte *sram_speicher, byte *screen, byte *palette, int16 frames, uint8 mode, int16 col) { + byte *sp = (byte *)MALLOC(8 * 8 + 4); if (!modul) { - i = 0; + int16 i = 0; if (col < 256) { for (i = 0; i < 13; i++) { + int16 x, y, x1; for (x = i; x < 39 - i; x++) out->box_fill(x * 8, i * 8, x * 8 + 8, i * 8 + 8, col); for (y = i; y < 24 - i; y++) out->box_fill(x * 8, y * 8, x * 8 + 8, y * 8 + 8, col); for (x1 = 39 - i; x1 > i; x1--) out->box_fill(x1 * 8, y * 8, x1 * 8 + 8, y * 8 + 8, col); - for (y1 = 24 - i; y1 >= i; y1--) + for (int16 y1 = 24 - i; y1 >= i; y1--) out->box_fill(x1 * 8, y1 * 8, x1 * 8 + 8, y1 * 8 + 8, col); out->skip_line(frames); } out->set_palette(palette); } - switch ((int16)mode) { - + switch (mode) { case 0: for (i = 13; i >= 0; i--) { + int16 x, y, x1; for (x = i; x < 39 - i; x++) { out->setze_zeiger(sram_speicher); out->sprite_save(sp, x * 8, i * 8, 8, 8, 0); @@ -112,7 +105,7 @@ void effect::blende1(byte *sram_speicher, byte *screen, out->setze_zeiger(screen); out->sprite_set(sp, x1 * 8, y * 8, 0); } - for (y1 = 24 - i; y1 > i; y1--) { + for (int16 y1 = 24 - i; y1 > i; y1--) { out->setze_zeiger(sram_speicher); out->sprite_save(sp, x1 * 8, y1 * 8, 8, 8, 0); out->setze_zeiger(screen); @@ -124,6 +117,7 @@ void effect::blende1(byte *sram_speicher, byte *screen, case 1: for (i = 0; i < 13; i++) { + int16 x, y, x1; for (x = i; x < 39 - i; x++) { out->setze_zeiger(sram_speicher); out->sprite_save(sp, x * 8, i * 8, 8, 8, 0); @@ -142,7 +136,7 @@ void effect::blende1(byte *sram_speicher, byte *screen, out->setze_zeiger(screen); out->sprite_set(sp, x1 * 8, y * 8, 0); } - for (y1 = 24 - i; y1 > i; y1--) { + for (int16 y1 = 24 - i; y1 > i; y1--) { out->setze_zeiger(sram_speicher); out->sprite_save(sp, x1 * 8, y1 * 8, 8, 8, 0); out->setze_zeiger(screen); @@ -152,6 +146,8 @@ void effect::blende1(byte *sram_speicher, byte *screen, } break; + default: + break; } free(sp); } @@ -178,10 +174,8 @@ void effect::border(byte *workpage_, int16 lines, uint8 mode, int16 farbe) { } void effect::spr_blende(byte *workpage_, int16 lines, bool mode, int16 col) { - int i, y; - if (mode) { - for (i = 0, y = 0; i < 20; ++i, y += 8) { + for (int i = 0, y = 0; i < 20; ++i, y += 8) { out->setze_zeiger(workpage_ + 4); out->box_fill(0, 92 - y, 320, 92 - y + 8, col); out->box_fill(0, 100 + y, 320, 108 + y, col); @@ -189,7 +183,7 @@ void effect::spr_blende(byte *workpage_, int16 lines, bool mode, int16 col) { out->skip_line(lines); } } else { - for (i = 0; i < 20; ++i) { + for (int i = 0; i < 20; ++i) { out->setze_zeiger(workpage_ + 4); out->box_fill(0, i, 320, i + 8, col); out->box_fill(0, 192 - i, 320, 200 - i, col); diff --git a/engines/chewy/flic.cpp b/engines/chewy/flic.cpp index 2db8db25e39..5a62c1a4dff 100644 --- a/engines/chewy/flic.cpp +++ b/engines/chewy/flic.cpp @@ -216,7 +216,7 @@ void flic::decode_frame() { case CLS: out->setze_zeiger(virt_screen); out->cls(); - out->setze_zeiger(0); + out->setze_zeiger(nullptr); update_flag = true; break; @@ -241,7 +241,7 @@ void flic::decode_frame() { if (flic_user) { out->setze_zeiger(virt_screen); flic_user(CurrentFrame); - out->setze_zeiger(0); + out->setze_zeiger(nullptr); } out->back2screen(virt_screen - 4); if (fade_flag != false) { @@ -740,7 +740,7 @@ void flic::decode_custom_frame(Common::SeekableReadStream *handle) { case CLEAR_SCREEN: out->setze_zeiger(virt_screen); out->cls(); - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); break; @@ -792,7 +792,7 @@ void flic::decode_cframe() { case CLS: out->setze_zeiger(virt_screen); out->cls(); - out->setze_zeiger(0); + out->setze_zeiger(nullptr); update_flag = true; break; @@ -822,7 +822,7 @@ void flic::decode_cframe() { out->back2back(virt_screen, load_puffer); out->setze_zeiger(virt_screen); custom_user(CurrentFrame); - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->back2screen(virt_screen - 4); out->back2back(load_puffer, virt_screen); } else diff --git a/engines/chewy/inits.cpp b/engines/chewy/inits.cpp index f5e567d587b..2863d8279b6 100644 --- a/engines/chewy/inits.cpp +++ b/engines/chewy/inits.cpp @@ -116,7 +116,6 @@ void standard_init() { } void var_init() { - int16 i; Rdi = det->get_room_detail_info(); Sdi = &Rdi->Sinfo[0]; Adi = &Rdi->Ainfo[0]; @@ -157,7 +156,7 @@ void var_init() { spieler_mi[P_NICHELLE].Mode = true; - for (i = 0; i < MAX_PERSON; i++) { + for (int16 i = 0; i < MAX_PERSON; i++) { PersonAni[i] = -1; PersonTaf[i] = 0; spieler_mi[i].Mode = false; @@ -203,8 +202,6 @@ void init_room() { } void init_atds() { - int16 i; - // Close any prior handles atds->close_handle(AAD_DATEI); atds->close_handle(ATS_DATEI); @@ -246,25 +243,22 @@ void init_atds() { _G(spieler).DelaySpeed = 5; spieler_vector[P_CHEWY].Delay = _G(spieler).DelaySpeed; atds->set_delay(&_G(spieler).DelaySpeed, _G(spieler).AadSilent); - for (i = 0; i < AAD_MAX_PERSON; i++) + for (int16 i = 0; i < AAD_MAX_PERSON; i++) atds->set_split_win(i, &ssi[i]); atds->set_string_end_func(&atds_string_start); ERROR } void new_game() { - int16 i; - byte *tmp; - _G(spieler).clear(); - for (i = 0; i < MAX_MOV_OBJ; i++) { + for (int16 i = 0; i < MAX_MOV_OBJ; i++) { _G(spieler).room_m_obj[i].RoomNr = -1; _G(spieler).InventSlot[i] = -1; } - for (i = 0; i < MAX_FEST_OBJ; i++) + for (int16 i = 0; i < MAX_FEST_OBJ; i++) _G(spieler).room_s_obj[i].RoomNr = -1; - for (i = 0; i < MAX_EXIT; i++) + for (int16 i = 0; i < MAX_EXIT; i++) _G(spieler).room_e_obj[i].RoomNr = -1; obj->load(INVENTAR_IIB, &_G(spieler).room_m_obj[0]); @@ -274,7 +268,7 @@ void new_game() { obj->load(EXIT_EIB, &_G(spieler).room_e_obj[0]); ERROR - tmp = (byte *)MALLOC(ROOM_ATS_MAX); + byte *tmp = (byte *)MALLOC(ROOM_ATS_MAX); ERROR Common::File f; @@ -291,7 +285,7 @@ void new_game() { } ERROR - for (i = 0; i < ROOM_ATS_MAX; i++) + for (int16 i = 0; i < ROOM_ATS_MAX; i++) _G(spieler).Ats[i * MAX_ATS_STATUS] = (uint8)tmp[i]; free(tmp); @@ -311,12 +305,12 @@ void new_game() { } ERROR - for (i = 0; i < MAX_MOV_OBJ; i++) + for (int16 i = 0; i < MAX_MOV_OBJ; i++) _G(spieler).InvAts[i * MAX_ATS_STATUS] = (uint8)tmp[i]; free(tmp); obj->sort(); - for (i = 0; i < obj->spieler_invnr[0]; i++) + for (int16 i = 0; i < obj->spieler_invnr[0]; i++) _G(spieler).InventSlot[i] = obj->spieler_invnr[i + 1]; AkChewyTaf = 0; @@ -359,7 +353,7 @@ void init_load() { ERROR spz_akt_id = -1; - spz_tinfo = 0; + spz_tinfo = nullptr; set_spz_delay(3); menutaf = mem->taf_adr(MENUTAF); @@ -376,10 +370,9 @@ void init_load() { } void get_detect(char *fname_) { - Stream *handle; modul = 0; fcode = 0; - handle = chewy_fopen(fname_, "rb"); + Stream *handle = chewy_fopen(fname_, "rb"); if (handle) { if (!chewy_fread(&detect, sizeof(DetectInfo), 1, handle)) { modul = DATEI; @@ -471,8 +464,8 @@ void sound_init() { _G(spieler).SoundVol = 63; ailsnd->set_music_mastervol(_G(spieler).MusicVol); ailsnd->set_sound_mastervol(_G(spieler).SoundVol); - ailsnd->switch_music(1); - ailsnd->switch_sound(1); + ailsnd->switch_music(true); + ailsnd->switch_sound(true); flags.InitSound = true; room->open_handle(DETAIL_TVP, "rb", R_VOCDATEI); diff --git a/engines/chewy/main.cpp b/engines/chewy/main.cpp index 602e47c1093..4b61bbc652f 100644 --- a/engines/chewy/main.cpp +++ b/engines/chewy/main.cpp @@ -706,7 +706,7 @@ void set_up_screen(SetupScreenMode mode) { _G(maus_links_click) = false; menu_flag = false; if (mode == DO_SETUP) { - out->setze_zeiger(0); + out->setze_zeiger(nullptr); switch (fx_blend) { case BLEND1: fx->blende1(workptr, screen0, pal, 150, 0, 0); diff --git a/engines/chewy/mcga.cpp b/engines/chewy/mcga.cpp index 2f549cae628..f897dc1cc68 100644 --- a/engines/chewy/mcga.cpp +++ b/engines/chewy/mcga.cpp @@ -147,10 +147,9 @@ void mem2mcga(const byte *ptr) { void mem2mcga_masked(const byte *ptr, int16 maske) { byte *destP = SCREEN; - byte pixel; for (int i = 0; i < SCREEN_WIDTH * SCREEN_HEIGHT; ++i, ++ptr, ++destP) { - pixel = *ptr; + byte pixel = *ptr; if (pixel != maske) *destP = pixel; } @@ -169,17 +168,15 @@ void mem2mem(const byte *ptr1, byte *ptr2) { } void mem2mem_masked(const byte *ptr1, byte *ptr2, int16 maske) { - byte pixel; - for (int i = 0; i < SCREEN_WIDTH * SCREEN_HEIGHT; ++i, ++ptr1, ++ptr2) { - pixel = *ptr1; + byte pixel = *ptr1; if (pixel != maske) *ptr2 = pixel; } } void map_spr_2screen(const byte *sptr, int16 x, int16 y) { - int width = *((const int16 *)sptr); + const int width = *((const int16 *)sptr); sptr += y * width + x; byte *destP = SCREEN; @@ -189,15 +186,14 @@ void map_spr_2screen(const byte *sptr, int16 x, int16 y) { } } -void spr_save_mcga(byte *sptr, int16 x, int16 y, int16 width, - int16 height, int16 scrWidth) { - int pitch; - byte *scrP; +void spr_save_mcga(byte *sptr, int16 x, int16 y, int16 width, int16 height, int16 scrWidth) { *((int16 *)sptr) = width; sptr += 2; *((int16 *)sptr) = height; sptr += 2; + int pitch; + byte *scrP; if (scrWidth == 0) { scrP = SCREEN + y * SCREEN_WIDTH + x; pitch = SCREEN_WIDTH; @@ -215,14 +211,14 @@ void spr_save_mcga(byte *sptr, int16 x, int16 y, int16 width, } void spr_set_mcga(const byte *sptr, int16 x, int16 y, int16 scrWidth) { - int pitch; - byte *scrP; - int width = *((const int16 *)sptr); + const int width = *((const int16 *)sptr); sptr += 2; - int height = *((const int16 *)sptr); + const int height = *((const int16 *)sptr); sptr += 2; if (width >= 1 && height >= 1) { + int pitch; + byte *scrP; if (scrWidth == 0) { scrP = SCREEN + y * SCREEN_WIDTH + x; pitch = SCREEN_WIDTH; diff --git a/engines/chewy/menus.cpp b/engines/chewy/menus.cpp index c4230751ed8..3b4cf612e8c 100644 --- a/engines/chewy/menus.cpp +++ b/engines/chewy/menus.cpp @@ -445,7 +445,7 @@ void invent_menu() { } if (menu_flag1 == false) cur->plot_cur(); - out->setze_zeiger(0); + out->setze_zeiger(nullptr); if (menu_flag1 == MENU_EINBLENDEN) { fx->blende1(workptr, screen0, 0, 200, 0, 300); } else if (menu_flag1 == MENU_AUSBLENDEN) diff --git a/engines/chewy/r_event.cpp b/engines/chewy/r_event.cpp index 34a1a147f6f..9d8ee811ff1 100644 --- a/engines/chewy/r_event.cpp +++ b/engines/chewy/r_event.cpp @@ -927,7 +927,7 @@ void flic_cut(int16 nr, int16 mode) { static const int16 FLIC_CUT_1113[] = { 113, 106, 103, 118, 120 }; int16 i, ret = 0; - out->setze_zeiger(0); + out->setze_zeiger(nullptr); det->disable_room_sound(); ailsnd->end_sound(); g_events->delay(50); diff --git a/engines/chewy/room.cpp b/engines/chewy/room.cpp index c4676b25f6b..ba57b20cc95 100644 --- a/engines/chewy/room.cpp +++ b/engines/chewy/room.cpp @@ -34,24 +34,21 @@ const int16 SURIMY_TAF19_PHASEN[4][2] = { }; Room::Room() { - int16 i; room_timer.TimerAnz = 0; room_timer.TimerStart = 0; init_ablage(); - for (i = 0; i < MAX_ROOM_HANDLE; i++) + for (int16 i = 0; i < MAX_ROOM_HANDLE; i++) roomhandle[i] = 0; } Room::~Room() { - int16 i; - for (i = 0; i < MAX_ROOM_HANDLE; i++) + for (int16 i = 0; i < MAX_ROOM_HANDLE; i++) if (roomhandle[i]) chewy_fclose(roomhandle[i]); free_ablage(); } Stream *Room::open_handle(const char *fname1, const char *fmode, int16 mode) { - Stream *stream; - stream = chewy_fopen(fname1, fmode); + Stream *stream = chewy_fopen(fname1, fmode); if (stream) { close_handle(mode); roomhandle[mode] = stream; @@ -70,8 +67,6 @@ void Room::close_handle(int16 mode) { } void Room::load_room(RaumBlk *Rb, int16 room_nr, Spieler *player) { - char tmp_str[MAXPATH]; - room_detail_info *Rdi_; modul = 0; fcode = 0; @@ -83,9 +78,10 @@ void Room::load_room(RaumBlk *Rb, int16 room_nr, Spieler *player) { if (player->SoundSwitch == false) det->disable_room_sound(); if (!modul) { - Rdi_ = det->get_room_detail_info(); + room_detail_info *Rdi_ = det->get_room_detail_info(); room_info = &Rdi_->Ri; if (room_info->TafLoad != 255) { + char tmp_str[MAXPATH]; strcpy(tmp_str, Rb->RoomDir); strcat(tmp_str, room_info->TafName); det->load_rdi_taf(tmp_str, room_info->TafLoad); @@ -122,7 +118,7 @@ void Room::load_room(RaumBlk *Rb, int16 room_nr, Spieler *player) { void Room::load_taf(const char *filename, byte **speicher, byte *palette, int16 sprnr) { uint32 imagesize[MAXSPRITE] = {0}; - if (palette != 0) + if (palette != nullptr) mem->file->load_palette(filename, palette, TAFDATEI); if (!modul) { imagesize[sprnr] = 0l; @@ -141,11 +137,10 @@ void Room::set_timer_start(int16 timer_start) { } void Room::add_timer_new_room() { - ani_detail_info *adi; room_timer.TimerAnz = 0; for (int i = 0; i < MAXDETAILS && room_timer.TimerAnz < MAX_ROOM_TIMER; i++) { - adi = det->get_ani_detail(i); + ani_detail_info *adi = det->get_ani_detail(i); if (adi->timer_start != 0) { set_timer(i, adi->timer_start); } else if (adi->start_flag || adi->repeat) { @@ -164,11 +159,9 @@ void Room::del_timer_old_room() { } int16 Room::set_timer(int16 ani_nr, int16 timer_end) { - int16 timer_nr_; - int16 ret; - timer_nr_ = room_timer.TimerStart + room_timer.TimerAnz; - ret = uhr->set_new_timer(timer_nr_, timer_end, SEC_MODE); + int16 timer_nr_ = room_timer.TimerStart + room_timer.TimerAnz; + int16 ret = uhr->set_new_timer(timer_nr_, timer_end, SEC_MODE); if (ret != -1) { room_timer.ObjNr[room_timer.TimerAnz] = ani_nr; room_timer.TimerNr[room_timer.TimerAnz] = timer_nr_; @@ -206,53 +199,48 @@ void Room::set_ak_pal(RaumBlk *Rb) { void Room::calc_invent(RaumBlk *Rb, Spieler *player) { byte *tmp_inv_spr[MAX_MOV_OBJ]; - int16 i; if (!modul) { obj->sort(); memcpy(tmp_inv_spr, Rb->InvSprAdr, MAX_MOV_OBJ * sizeof(char *)); memset(Rb->InvSprAdr, 0, MAX_MOV_OBJ * sizeof(char *)); - for (i = 1; i < obj->mov_obj_room[0] + 1; i++) { + for (int16 i = 1; i < obj->mov_obj_room[0] + 1; i++) { if (!tmp_inv_spr[obj->mov_obj_room[i]]) { - load_taf(Rb->InvFile, &Rb->InvSprAdr[obj->mov_obj_room[i]], - 0, (int16)obj->mov_obj_room[i]); + load_taf(Rb->InvFile, &Rb->InvSprAdr[obj->mov_obj_room[i]], nullptr, (int16)obj->mov_obj_room[i]); } else { Rb->InvSprAdr[obj->mov_obj_room[i]] = tmp_inv_spr[obj->mov_obj_room[i]]; - tmp_inv_spr[obj->mov_obj_room[i]] = 0; + tmp_inv_spr[obj->mov_obj_room[i]] = nullptr; } } - for (i = 1; i < obj->spieler_invnr[0] + 1; i++) { + for (int16 i = 1; i < obj->spieler_invnr[0] + 1; i++) { if (!tmp_inv_spr[obj->spieler_invnr[i]]) { - load_taf(Rb->InvFile, &Rb->InvSprAdr[obj->spieler_invnr[i]], - 0, (int16)obj->spieler_invnr[i]); + load_taf(Rb->InvFile, &Rb->InvSprAdr[obj->spieler_invnr[i]], nullptr, (int16)obj->spieler_invnr[i]); } else { Rb->InvSprAdr[obj->spieler_invnr[i]] = tmp_inv_spr[obj->spieler_invnr[i]]; tmp_inv_spr[obj->spieler_invnr[i]] = 0; } } - for (i = 0; i < MAX_MOV_OBJ; i++) + for (int16 i = 0; i < MAX_MOV_OBJ; i++) { if (tmp_inv_spr[i] != 0) free(tmp_inv_spr[i]); + } + if (player->AkInvent != -1) { - if (Rb->InvSprAdr[player->AkInvent] == NULL) - load_taf(Rb->InvFile, &Rb->InvSprAdr[player->AkInvent], - 0, (int16)player->AkInvent); + if (Rb->InvSprAdr[player->AkInvent] == nullptr) + load_taf(Rb->InvFile, &Rb->InvSprAdr[player->AkInvent], nullptr, (int16)player->AkInvent); } } } int16 Room::load_tgp(int16 nr, RaumBlk *Rb, int16 tgp_idx, int16 mode) { - Common::SeekableReadStream *rs = dynamic_cast( - roomhandle[R_TGPDATEI]); + Common::SeekableReadStream *rs = dynamic_cast(roomhandle[R_TGPDATEI]); tbf_dateiheader tb; bool ret = false; - int16 *tmp; - ret = false; if (rs) { mem->file->select_pool_item(rs, nr); @@ -282,7 +270,7 @@ int16 Room::load_tgp(int16 nr, RaumBlk *Rb, int16 tgp_idx, int16 mode) { ged->load_ged_pool(gstream, &GedInfo[Rb->AkAblage], nr, GedMem[Rb->AkAblage]); if (!modul) { - tmp = (int16 *)Ablage[Rb->AkAblage]; + int16 *tmp = (int16 *)Ablage[Rb->AkAblage]; GedXAnz[Rb->AkAblage] = tmp[0] / GedInfo[Rb->AkAblage].X; GedYAnz[Rb->AkAblage] = tmp[1] / GedInfo[Rb->AkAblage].Y; } else { @@ -305,14 +293,13 @@ int16 Room::load_tgp(int16 nr, RaumBlk *Rb, int16 tgp_idx, int16 mode) { } void Room::init_ablage() { - int16 i; LastAblageSave = 0; Ablage[0] = (byte *)MALLOC(MAX_ABLAGE * (ABLAGE_BLOCK_SIZE + 4l)); AblagePal[0] = (byte *)MALLOC(MAX_ABLAGE * 768l); GedMem[0] = (byte *)MALLOC(MAX_ABLAGE * GED_BLOCK_SIZE); if (!modul) { AkAblage = 0; - for (i = 0; i < MAX_ABLAGE; i++) { + for (int16 i = 0; i < MAX_ABLAGE; i++) { Ablage[i] = Ablage[0] + (ABLAGE_BLOCK_SIZE + 4l) * i; AblageInfo[i][0] = -1; AblageInfo[i][1] = -1; @@ -361,17 +348,13 @@ byte **Room::get_ged_mem() { } int16 Room::get_ablage(int16 pic_nr, uint32 pic_size) { - int16 ende; - uint32 ablage_bedarf; - int16 ret; - int16 i, j; - ret = -1; - ablage_bedarf = pic_size / ABLAGE_BLOCK_SIZE; + int16 ret = -1; + uint32 ablage_bedarf = pic_size / ABLAGE_BLOCK_SIZE; if (pic_size % ABLAGE_BLOCK_SIZE > 4) ++ablage_bedarf; - ende = 0; + int16 ende = 0; - for (i = 0; i < MAX_ABLAGE && !ende; i++) { + for (int16 i = 0; i < MAX_ABLAGE && !ende; i++) { if (AblageInfo[i][0] == pic_nr && AblageInfo[i][1] != 255) { ende = 1; @@ -380,7 +363,7 @@ int16 Room::get_ablage(int16 pic_nr, uint32 pic_size) { } if (!ende) { - for (i = 0; i < MAX_ABLAGE && !ende; i++) { + for (int16 i = 0; i < MAX_ABLAGE && !ende; i++) { ret = get_ablage_g1((int16)ablage_bedarf, i); ende = 1; } @@ -399,8 +382,8 @@ int16 Room::get_ablage(int16 pic_nr, uint32 pic_size) { } else ende = 1; } - i = AblageInfo[LastAblageSave][1]; - for (j = LastAblageSave; j < LastAblageSave + i; j++) { + int16 i = AblageInfo[LastAblageSave][1]; + for (int16 j = LastAblageSave; j < LastAblageSave + i; j++) { AblageInfo[j][0] = -1; AblageInfo[j][1] = -1; } @@ -410,11 +393,9 @@ int16 Room::get_ablage(int16 pic_nr, uint32 pic_size) { } int16 Room::get_ablage_g1(int16 ablage_bedarf, int16 ak_pos) { - int16 ende; short ret = 0; - int16 count; - ende = 0; - count = 0; + int16 ende = 0; + int16 count = 0; LastAblageSave = ak_pos; while (!ende) { if (LastAblageSave >= MAX_ABLAGE) @@ -422,12 +403,10 @@ int16 Room::get_ablage_g1(int16 ablage_bedarf, int16 ak_pos) { if (ablage_bedarf == 1) { ende = 1; ret = LastAblageSave; - } - else if (ablage_bedarf <= MAX_ABLAGE - LastAblageSave) { + } else if (ablage_bedarf <= MAX_ABLAGE - LastAblageSave) { ende = 1; ret = LastAblageSave; - } - else + } else ++LastAblageSave; ++count; if (count > MAX_ABLAGE) { @@ -439,14 +418,11 @@ int16 Room::get_ablage_g1(int16 ablage_bedarf, int16 ak_pos) { } void Room::set_ablage_info(int16 ablagenr, int16 bildnr, uint32 pic_size) { - uint32 ablage_bedarf; - int16 i; - int16 j; - ablage_bedarf = (pic_size / ABLAGE_BLOCK_SIZE); + uint32 ablage_bedarf = (pic_size / ABLAGE_BLOCK_SIZE); if (pic_size % ABLAGE_BLOCK_SIZE > 4) ++ablage_bedarf; - j = (int16)ablage_bedarf; - for (i = ablagenr; i < j + ablagenr; i++) { + int16 j = (int16)ablage_bedarf; + for (int16 i = ablagenr; i < j + ablagenr; i++) { AblageInfo[i][0] = bildnr; AblageInfo[i][1] = (int16)ablage_bedarf; ablage_bedarf = 255; @@ -455,7 +431,7 @@ void Room::set_ablage_info(int16 ablagenr, int16 bildnr, uint32 pic_size) { } void Room::load_sound() { - if ((!modul) && (flags.InitSound)) { + if (!modul && flags.InitSound) { det->load_room_sounds(roomhandle[R_VOCDATEI]); } } @@ -467,14 +443,14 @@ Stream *Room::get_sound_handle() { void load_chewy_taf(int16 taf_nr) { - taf_dateiheader *tafheader; - const char *fname_; if (AkChewyTaf != taf_nr) { if (chewy) { free((char *)chewy); chewy = nullptr; } spieler_mi[P_CHEWY].HotY = CH_HOT_Y; + + const char *fname_; switch (taf_nr) { case CHEWY_NORMAL: fname_ = CHEWY_TAF; @@ -524,7 +500,8 @@ void load_chewy_taf(int16 taf_nr) { chewy = mem->taf_adr(fname_); ERROR - mem->file->get_tafinfo(fname_, &tafheader); + taf_dateiheader *tafheader; + mem->file->get_tafinfo(fname_, &tafheader); if (!modul) { chewy_kor = chewy->korrektur; } else { @@ -546,8 +523,7 @@ void switch_room(int16 nr) { } void calc_person_look() { - int16 i; - for (i = 1; i < MAX_PERSON; i++) { + for (int16 i = 1; i < MAX_PERSON; i++) { if (spieler_mi[i].Id != NO_MOV_OBJ) { if (spieler_vector[i].Xypos[0] > spieler_vector[P_CHEWY].Xypos[0]) diff --git a/engines/chewy/rooms/room1.cpp b/engines/chewy/rooms/room1.cpp index 8ec140291ce..2530869e61f 100644 --- a/engines/chewy/rooms/room1.cpp +++ b/engines/chewy/rooms/room1.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room1.h" @@ -30,22 +29,21 @@ namespace Chewy { namespace Rooms { void Room1::gottenCard() { - int16 tmp; - det->hide_static_spr(2); start_detail_wait(4, 1, ANI_VOR); _G(spieler).PersonHide[P_CHEWY] = false; atds->del_steuer_bit(7, ATS_COUNT_BIT, ATS_DATEI); + int16 tmp; atds->ats_get_txt(7, TXT_MARK_LOOK, &tmp, ATS_DATEI); } void Room1::gedAction(int index) { #define KABELABDECKUNG 1 - bool flag = false; switch (index) { case 0: if (!_G(spieler).R2ElectrocutedBork) { + bool flag = false; if (_G(spieler).AkInvent == KABEL_INV) { flag = true; del_inventar(_G(spieler).AkInvent); diff --git a/engines/chewy/rooms/room10.cpp b/engines/chewy/rooms/room10.cpp index 24a89211bcc..919cfdf2e65 100644 --- a/engines/chewy/rooms/room10.cpp +++ b/engines/chewy/rooms/room10.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room6.h" #include "chewy/rooms/room10.h" @@ -34,7 +33,7 @@ void Room10::entry() { if (!_G(spieler).R10Surimy) { out->setze_zeiger(workptr); out->map_spr2screen(ablage[room_blk.AkAblage], _G(spieler).scrollx, _G(spieler).scrolly); - out->setze_zeiger(0); + out->setze_zeiger(nullptr); fx->blende1(workptr, screen0, pal, 150, 0, 0); _G(spieler).R10Surimy = true; fx_blend = BLEND_NONE; diff --git a/engines/chewy/rooms/room12.cpp b/engines/chewy/rooms/room12.cpp index aef6824a941..0ecb387b8c6 100644 --- a/engines/chewy/rooms/room12.cpp +++ b/engines/chewy/rooms/room12.cpp @@ -117,7 +117,7 @@ void Room12::init_bork() { !_G(spieler).R12BorkTalk) { if (!_G(auto_obj)) - det->load_taf_seq(62, (85 - 62) + 1, 0); + det->load_taf_seq(62, (85 - 62) + 1, nullptr); if (!flags.AutoAniPlay && !flags.ChAutoMov) { _G(auto_obj) = 1; mov_phasen[R12_BORK_OBJ].AtsText = 120; @@ -127,8 +127,7 @@ void Room12::init_bork() { auto_mov_obj[R12_BORK_OBJ].Id = AUTO_OBJ0; auto_mov_vector[R12_BORK_OBJ].Delay = _G(spieler).DelaySpeed; auto_mov_obj[R12_BORK_OBJ].Mode = true; - init_auto_obj(R12_BORK_OBJ, &R12_BORK_PHASEN[0][0], mov_phasen[R12_BORK_OBJ].Lines, - (const MovLine *)R12_BORK_MPKT); + init_auto_obj(R12_BORK_OBJ, &R12_BORK_PHASEN[0][0], mov_phasen[R12_BORK_OBJ].Lines, (const MovLine *)R12_BORK_MPKT); if (!_G(spieler).R12TalismanOk) { hide_cur(); @@ -171,8 +170,7 @@ void Room12::bork_ok() { mov_phasen[R12_BORK_OBJ].Repeat = 1; mov_phasen[R12_BORK_OBJ].Lines = 2; - init_auto_obj(R12_BORK_OBJ, &R12_BORK_PHASEN[0][0], mov_phasen[R12_BORK_OBJ].Lines, - (const MovLine *)R12_BORK_MPKT1); + init_auto_obj(R12_BORK_OBJ, &R12_BORK_PHASEN[0][0], mov_phasen[R12_BORK_OBJ].Lines, (const MovLine *)R12_BORK_MPKT1); wait_auto_obj(R12_BORK_OBJ); _G(spieler).R12BorkInRohr = true; diff --git a/engines/chewy/rooms/room13.cpp b/engines/chewy/rooms/room13.cpp index 2281b18eec1..60e9d1fd2cd 100644 --- a/engines/chewy/rooms/room13.cpp +++ b/engines/chewy/rooms/room13.cpp @@ -59,7 +59,7 @@ void Room13::entry() { if (!_G(spieler).R13BorkOk) { det->show_static_spr(12); obj->hide_sib(SIB_BANDKNOPF_R13); - _G(spieler).R13Bandlauf = 1; + _G(spieler).R13Bandlauf = true; atds->set_ats_str(94, TXT_MARK_LOOK, _G(spieler).R13Bandlauf, ATS_DATEI); @@ -104,11 +104,11 @@ void Room13::talk_bork() { _G(spieler).R12ChewyBork = false; det->show_static_spr(13); det->set_detail_pos(10, spieler_vector[P_CHEWY].Xypos[0], spieler_vector[P_CHEWY].Xypos[1]); - det->set_static_pos(12, spieler_vector[P_CHEWY].Xypos[0], spieler_vector[P_CHEWY].Xypos[1], 0, true); + det->set_static_pos(12, spieler_vector[P_CHEWY].Xypos[0], spieler_vector[P_CHEWY].Xypos[1], false, true); _G(spieler).PersonHide[P_CHEWY] = true; start_aad_wait(33, -1); det->stop_detail(9); - det->load_taf_seq(86, (97 - 86) + 1, 0); + det->load_taf_seq(86, (97 - 86) + 1, nullptr); _G(spieler).PersonHide[P_CHEWY] = false; det->hide_static_spr(12); _G(auto_obj) = 1; @@ -120,8 +120,7 @@ void Room13::talk_bork() { auto_mov_obj[R13_BORK_OBJ].Id = AUTO_OBJ0; auto_mov_vector[R13_BORK_OBJ].Delay = _G(spieler).DelaySpeed; auto_mov_obj[R13_BORK_OBJ].Mode = true; - init_auto_obj(R13_BORK_OBJ, &R13_BORK_PHASEN[0][0], mov_phasen[R13_BORK_OBJ].Lines, - (const MovLine *)R13_BORK_MPKT); + init_auto_obj(R13_BORK_OBJ, &R13_BORK_PHASEN[0][0], mov_phasen[R13_BORK_OBJ].Lines, (const MovLine *)R13_BORK_MPKT); auto_move(9, P_CHEWY); wait_auto_obj(R13_BORK_OBJ); auto_move(11, P_CHEWY); diff --git a/engines/chewy/rooms/room17.cpp b/engines/chewy/rooms/room17.cpp index 06cf3054e18..e482024de6b 100644 --- a/engines/chewy/rooms/room17.cpp +++ b/engines/chewy/rooms/room17.cpp @@ -162,16 +162,15 @@ int16 Room17::use_seil() { } void Room17::plot_seil() { - int16 i; if (_G(spieler).R17Seil) { - for (i = 0; i < 3; i++) + for (int16 i = 0; i < 3; i++) det->show_static_spr(8 + i); } } void Room17::kletter_down() { auto_move(5, P_CHEWY); - det->load_taf_seq(177, 1, 0); + det->load_taf_seq(177, 1, nullptr); _G(spieler).PersonHide[P_CHEWY] = true; start_detail_wait(14, 1, ANI_VOR); flags.ZoomMov = false; @@ -181,14 +180,13 @@ void Room17::kletter_down() { spieler_mi->Vorschub = 8; _G(zoom_horizont) = 399; _G(auto_obj) = 1; - init_auto_obj(CHEWY_OBJ, &CHEWY_PHASEN[0][0], mov_phasen[CHEWY_OBJ].Lines, - (const MovLine *)CHEWY_MPKT); + init_auto_obj(CHEWY_OBJ, &CHEWY_PHASEN[0][0], mov_phasen[CHEWY_OBJ].Lines, (const MovLine *)CHEWY_MPKT); set_person_pos(242, 350, P_CHEWY, P_LEFT); } void Room17::kletter_up() { auto_move(6, P_CHEWY); - det->load_taf_seq(141, 4, 0); + det->load_taf_seq(141, 4, nullptr); _G(spieler).PersonHide[P_CHEWY] = true; start_detail_wait(11, 1, ANI_VOR); flags.ZoomMov = true; @@ -197,8 +195,7 @@ void Room17::kletter_up() { room->set_zoom(25); _G(zoom_horizont) = 0; _G(auto_obj) = 1; - init_auto_obj(CHEWY_OBJ, &CHEWY_PHASEN[0][0], mov_phasen[CHEWY_OBJ].Lines, - (const MovLine *)CHEWY_MPKT1); + init_auto_obj(CHEWY_OBJ, &CHEWY_PHASEN[0][0], mov_phasen[CHEWY_OBJ].Lines, (const MovLine *)CHEWY_MPKT1); set_person_pos(243, 146, P_CHEWY, P_LEFT); } diff --git a/engines/chewy/rooms/room18.cpp b/engines/chewy/rooms/room18.cpp index 37b9708f413..0563d1ef03e 100644 --- a/engines/chewy/rooms/room18.cpp +++ b/engines/chewy/rooms/room18.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room18.h" @@ -88,8 +87,6 @@ static const AniBlock ABLOCK24[2] = { void Room18::entry() { - int16 i; - _G(spieler).R18MoniSwitch = false; atds->set_ats_str(151, TXT_MARK_LOOK, 0, ATS_DATEI); _G(spieler).ScrollxStep = 2; @@ -99,9 +96,9 @@ void Room18::entry() { if (!_G(spieler).R18SurimyWurf) { init_borks(); } else { - for (i = 0; i < 5; i++) + for (int16 i = 0; i < 5; i++) det->hide_static_spr(BORK_SPR[i]); - for (i = 0; i < (4 - _G(spieler).R18Krone ? 1 : 0); i++) + for (int16 i = 0; i < (4 - (_G(spieler).R18Krone ? 1 : 0)); i++) det->show_static_spr(BORK_SPR1[i]); } @@ -171,11 +168,9 @@ void Room18::gedAction(int index) { } void Room18::init_borks() { - int16 i; - - for (i = 0; i < 5; i++) + for (int16 i = 0; i < 5; i++) det->show_static_spr(BORK_SPR[i]); - for (i = 0; i < 4; i++) + for (int16 i = 0; i < 4; i++) det->hide_static_spr(BORK_SPR1[i]); _G(timer_nr)[0] = room->set_timer(255, 10); @@ -186,10 +181,9 @@ void Room18::init_borks() { } void Room18::monitor() { - int16 nr; - nr = 0; _G(spieler).R18MoniSwitch ^= 1; + int16 nr = 0; if (_G(spieler).R18MoniSwitch) { start_ani_block(2, ABLOCK21); if (_G(spieler).R17EnergieOut) @@ -205,7 +199,6 @@ void Room18::monitor() { } int16 Room18::sonden_moni() { - int16 i; int16 action_flag = false; if (!_G(spieler).inv_cur && !_G(spieler).R18Gitter) { @@ -217,12 +210,12 @@ int16 Room18::sonden_moni() { det->show_static_spr(10); start_ani_block(3, ABLOCK20); - for (i = 0; i < 3; i++) + for (int16 i = 0; i < 3; i++) det->show_static_spr(i + 12); wait_show_screen(40); - for (i = 0; i < 5; i++) + for (int16 i = 0; i < 5; i++) det->hide_static_spr(i + 10); show_cur(); @@ -231,7 +224,6 @@ int16 Room18::sonden_moni() { } int16 Room18::calc_surimy() { - int16 i; int16 action_flag = false; if (is_cur_inventar(SURIMY_INV)) { @@ -240,8 +232,8 @@ int16 Room18::calc_surimy() { hide_cur(); del_inventar(_G(spieler).AkInvent); _G(spieler).R18SurimyWurf = true; - det->load_taf_seq(245, 294 - 245 + 1, 0); - det->load_taf_seq(116, 170 - 116 + 1, 0); + det->load_taf_seq(245, 294 - 245 + 1, nullptr); + det->load_taf_seq(116, 170 - 116 + 1, nullptr); _G(auto_obj) = 1; mov_phasen[SURIMY_OBJ].AtsText = 0; mov_phasen[SURIMY_OBJ].Lines = 2; @@ -254,8 +246,7 @@ int16 Room18::calc_surimy() { if (spieler_vector[P_CHEWY].Xypos[1] < 150) { start_detail_frame(18, 1, ANI_VOR, 8); - init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, - (const MovLine *)SURIMY_MPKT3); + init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, (const MovLine *)SURIMY_MPKT3); wait_detail(18); } else { auto_move(1, P_CHEWY); @@ -264,8 +255,7 @@ int16 Room18::calc_surimy() { start_detail_frame(17, 1, ANI_VOR, 12); _G(maus_links_click) = false; - init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, - (const MovLine *)SURIMY_MPKT); + init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, (const MovLine *)SURIMY_MPKT); wait_detail(17); } @@ -284,7 +274,7 @@ int16 Room18::calc_surimy() { start_ani_block(2, ABLOCK22); det->show_static_spr(20); - for (i = 0; i < 3; i++) + for (int16 i = 0; i < 3; i++) det->hide_static_spr(i + 15); start_ani_block(2, ABLOCK23); @@ -294,8 +284,7 @@ int16 Room18::calc_surimy() { flags.NoScroll = true; mov_phasen[SURIMY_OBJ].Repeat = 1; - init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, - (const MovLine *)SURIMY_MPKT1); + init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, (const MovLine *)SURIMY_MPKT1); auto_scroll(70, 0); wait_auto_obj(SURIMY_OBJ); @@ -313,8 +302,7 @@ int16 Room18::calc_surimy() { det->hide_static_spr(26); mov_phasen[SURIMY_OBJ].Repeat = 1; - init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, - (const MovLine *)SURIMY_MPKT2); + init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, (const MovLine *)SURIMY_MPKT2); auto_scroll(0, 0); wait_auto_obj(SURIMY_OBJ); _G(spieler).ScrollxStep = 6; @@ -326,7 +314,7 @@ int16 Room18::calc_surimy() { atds->set_ats_str(153, 1, ATS_DATEI); atds->set_ats_str(149, TXT_MARK_LOOK, 1, ATS_DATEI); - for (i = 0; i < 3; i++) + for (int16 i = 0; i < 3; i++) atds->del_steuer_bit(158 + i, ATS_AKTIV_BIT, ATS_DATEI); atds->del_steuer_bit(179, 0, 1); diff --git a/engines/chewy/rooms/room21.cpp b/engines/chewy/rooms/room21.cpp index 538e94001b2..3e31ce06044 100644 --- a/engines/chewy/rooms/room21.cpp +++ b/engines/chewy/rooms/room21.cpp @@ -115,7 +115,7 @@ void Room21::calc_laser() { } void Room21::init_spinne() { - det->load_taf_seq(42, (89 - 42) + 1, 0); + det->load_taf_seq(42, (89 - 42) + 1, nullptr); _G(auto_obj) = 2; mov_phasen[SPINNE1_OBJ].AtsText = 130; @@ -168,24 +168,14 @@ void Room21::setup_func() { } void Room21::chewy_kolli() { - int16 spr_nr; - int16 *Cxy; - int16 xoff; - int16 yoff; - int16 *xy; - int16 kolli; - int16 i; - int16 ani_nr; - int16 tmp; - kolli = false; + int16 kolli = false; - for (i = 0; i < 3 && !kolli; i++) { - spr_nr = mov_phasen[i].Phase[auto_mov_vector[i].Phase][0] + - auto_mov_vector[i].PhNr; - xy = (int16 *)room_blk.DetImage[spr_nr]; - Cxy = room_blk.DetKorrekt + (spr_nr << 1); - xoff = xy[0]; - yoff = xy[1]; + for (int16 i = 0; i < 3 && !kolli; i++) { + int16 spr_nr = mov_phasen[i].Phase[auto_mov_vector[i].Phase][0] + auto_mov_vector[i].PhNr; + int16 *xy = (int16 *)room_blk.DetImage[spr_nr]; + int16 *Cxy = room_blk.DetKorrekt + (spr_nr << 1); + int16 xoff = xy[0]; + int16 yoff = xy[1]; if (i == 2) xoff += 10; xoff += auto_mov_vector[i].Xzoom; @@ -205,10 +195,11 @@ void Room21::chewy_kolli() { if (kolli) { if (!flags.AutoAniPlay) { - tmp = spieler_vector[P_CHEWY].Count; + const int16 tmp = spieler_vector[P_CHEWY].Count; stop_person(P_CHEWY); flags.AutoAniPlay = true; _G(spieler).PersonHide[P_CHEWY] = true; + int16 ani_nr; if (spieler_vector[P_CHEWY].Xyvo[0] < 0) ani_nr = 10; else @@ -226,8 +217,6 @@ void Room21::chewy_kolli() { } void Room21::salto() { - int16 i; - if (!_G(spieler).inv_cur) { if (atds->get_ats_str(134, TXT_MARK_USE, ATS_DATEI) == 8) { if (!_G(spieler).R21Salto) { @@ -236,7 +225,7 @@ void Room21::salto() { flags.AutoAniPlay = true; _G(spieler).PersonHide[P_CHEWY] = true; - for (i = 0; i < 3; i++) { + for (int16 i = 0; i < 3; i++) { det->set_detail_pos(12 + i, spieler_vector[P_CHEWY].Xypos[0], spieler_vector[P_CHEWY].Xypos[1]); } diff --git a/engines/chewy/rooms/room22.cpp b/engines/chewy/rooms/room22.cpp index 85dee31aad1..78895590cf3 100644 --- a/engines/chewy/rooms/room22.cpp +++ b/engines/chewy/rooms/room22.cpp @@ -61,7 +61,7 @@ AniBlock ABLOCK14[2] = { void Room22::entry() { if (!_G(spieler).R22BorkPlatt) { - det->load_taf_seq(36, (56 - 36) + 1, 0); + det->load_taf_seq(36, (56 - 36) + 1, nullptr); room->set_timer(255, 15); } else if (_G(spieler).R22ChewyPlatt && !_G(spieler).R22GetBork) { det->show_static_spr(4); @@ -137,21 +137,18 @@ void Room22::bork(int16 t_nr) { } void Room22::bork_walk1() { - init_auto_obj(BORK_OBJ, &BORK_PHASEN[0][0], mov_phasen[BORK_OBJ].Lines, - (const MovLine *)BORK_MPKT); + init_auto_obj(BORK_OBJ, &BORK_PHASEN[0][0], mov_phasen[BORK_OBJ].Lines, (const MovLine *)BORK_MPKT); wait_auto_obj(BORK_OBJ); start_detail_wait(2, 1, ANI_VOR); mov_phasen[BORK_OBJ].Repeat = 1; - init_auto_obj(BORK_OBJ, &BORK_PHASEN[0][0], mov_phasen[BORK_OBJ].Lines, - (const MovLine *)BORK_MPKT1); + init_auto_obj(BORK_OBJ, &BORK_PHASEN[0][0], mov_phasen[BORK_OBJ].Lines, (const MovLine *)BORK_MPKT1); wait_auto_obj(BORK_OBJ); } void Room22::bork_walk2() { - init_auto_obj(BORK_OBJ, &BORK_PHASEN[0][0], mov_phasen[BORK_OBJ].Lines, - (const MovLine *)BORK_MPKT2); + init_auto_obj(BORK_OBJ, &BORK_PHASEN[0][0], mov_phasen[BORK_OBJ].Lines, (const MovLine *)BORK_MPKT2); wait_auto_obj(BORK_OBJ); flic_cut(FCUT_009, CFO_MODE); diff --git a/engines/chewy/rooms/room23.cpp b/engines/chewy/rooms/room23.cpp index 22069782124..b8f9cb066c7 100644 --- a/engines/chewy/rooms/room23.cpp +++ b/engines/chewy/rooms/room23.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room23.h" @@ -55,17 +54,14 @@ void Room23::cockpit() { } int16 Room23::start_gleiter() { - int16 i; - int16 start_ok; int16 action_flag = false; if (!_G(spieler).inv_cur) { action_flag = true; - start_ok = false; if (!_G(spieler).R23FluxoFlex) start_aad_wait(23, -1); else { - start_ok = true; + bool start_ok = true; if (_G(spieler).R23GleiterExit == 16) { if (!_G(spieler).R16F5Exit) { @@ -85,11 +81,11 @@ int16 Room23::start_gleiter() { start_ani_block(4, ABLOCK15); wait_show_screen(30); - for (i = 0; i < 4; i++) + for (int16 i = 0; i < 4; i++) det->stop_detail(i); if (_G(spieler).R23GleiterExit == 14) { - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); flic_cut(FCUT_012, CFO_MODE); out->cls(); @@ -106,7 +102,7 @@ int16 Room23::start_gleiter() { _G(maus_links_click) = false; } else if (_G(spieler).R23GleiterExit == 16) { - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); flic_cut(FCUT_019, CFO_MODE); _G(spieler).R23GleiterExit = 25; diff --git a/engines/chewy/rooms/room25.cpp b/engines/chewy/rooms/room25.cpp index ea10af9b336..e75047aeb08 100644 --- a/engines/chewy/rooms/room25.cpp +++ b/engines/chewy/rooms/room25.cpp @@ -23,7 +23,6 @@ #include "chewy/events.h" #include "chewy/global.h" #include "chewy/ani_dat.h" -#include "chewy/room.h" #include "chewy/rooms/room23.h" #include "chewy/rooms/room25.h" @@ -156,7 +155,7 @@ void Room25::xit_gleiter() { if (!_G(spieler).R25SurimyLauf) { hide_cur(); _G(spieler).R25SurimyLauf = true; - det->load_taf_seq(56, 8, 0); + det->load_taf_seq(56, 8, nullptr); _G(auto_obj) = 1; mov_phasen[SURIMY_OBJ].AtsText = 0; mov_phasen[SURIMY_OBJ].Lines = 2; @@ -165,8 +164,7 @@ void Room25::xit_gleiter() { auto_mov_obj[SURIMY_OBJ].Id = AUTO_OBJ0; auto_mov_vector[SURIMY_OBJ].Delay = _G(spieler).DelaySpeed + 2; auto_mov_obj[SURIMY_OBJ].Mode = true; - init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, - (const MovLine *)SURIMY_MPKT); + init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, (const MovLine *)SURIMY_MPKT); fx_blend = BLEND1; set_up_screen(DO_SETUP); diff --git a/engines/chewy/rooms/room28.cpp b/engines/chewy/rooms/room28.cpp index 4fefc14ab63..2fdc56a7aba 100644 --- a/engines/chewy/rooms/room28.cpp +++ b/engines/chewy/rooms/room28.cpp @@ -103,7 +103,7 @@ void Room28::entry(int16 eib_nr) { case 77: if (_G(spieler).R28PostCar) { _G(spieler).R28PostCar = false; - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); flic_cut(FCUT_063, FLC_MODE); _G(spieler).R28ChewyPump = false; @@ -202,10 +202,9 @@ void Room28::haendler() { } void Room28::setup_func() { - int16 x; calc_person_look(); - x = (spieler_vector[P_CHEWY].Xypos[0] > 350) ? 420 : 320; + int16 x = (spieler_vector[P_CHEWY].Xypos[0] > 350) ? 420 : 320; go_auto_xy(x, 113, P_HOWARD, ANI_GO); } @@ -244,7 +243,6 @@ void Room28::use_surimy() { } void Room28::set_pump() { - int16 tmp; hide_cur(); if (_G(spieler).PersonRoomNr[P_CHEWY] == 28) { @@ -254,7 +252,7 @@ void Room28::set_pump() { auto_move(5, P_CHEWY); _G(spieler).PersonHide[P_CHEWY] = true; - tmp = (person_end_phase[P_CHEWY] == P_RIGHT) ? 1 : 0; + int16 tmp = (person_end_phase[P_CHEWY] == P_RIGHT) ? 1 : 0; del_inventar(K_MASKE_INV); det->set_detail_pos(tmp, spieler_vector[P_CHEWY].Xypos[0], spieler_vector[P_CHEWY].Xypos[1]); @@ -299,14 +297,13 @@ void Room28::set_pump() { } void Room28::get_pump() { - int16 tmp; if (_G(spieler).R28ChewyPump) { hide_cur(); stop_person(P_CHEWY); _G(spieler).R28ChewyPump = false; _G(spieler).PersonHide[P_CHEWY] = true; - tmp = (person_end_phase[P_CHEWY] == P_RIGHT) ? 1 : 0; + int16 tmp = (person_end_phase[P_CHEWY] == P_RIGHT) ? 1 : 0; det->set_detail_pos(tmp, spieler_vector[P_CHEWY].Xypos[0], spieler_vector[P_CHEWY].Xypos[1]); start_detail_wait(tmp, 1, ANI_RUECK); diff --git a/engines/chewy/rooms/room3.cpp b/engines/chewy/rooms/room3.cpp index 339b91b9860..5609825744f 100644 --- a/engines/chewy/rooms/room3.cpp +++ b/engines/chewy/rooms/room3.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room2.h" #include "chewy/rooms/room3.h" @@ -106,7 +105,7 @@ void Room3::terminal() { det->stop_detail(5); start_ani_block(2, ABLOCK3); if (_G(spieler).R2FussSchleim) { - _G(spieler).R2FussSchleim = 0; + _G(spieler).R2FussSchleim = false; _G(spieler).room_s_obj[SIB_SCHLEIM].ZustandFlipFlop = 1; } @@ -131,7 +130,8 @@ void Room3::terminal() { _G(auto_obj) = 0; room->load_room(&room_blk, _G(spieler).PersonRoomNr[P_CHEWY], &_G(spieler)); ERROR - fx_blend = BLEND1; + + fx_blend = BLEND1; start_ani_block(3, ablock5); set_person_pos(91, 107, P_CHEWY, P_LEFT); _G(spieler).PersonHide[P_CHEWY] = false; @@ -152,6 +152,8 @@ void Room3::terminal() { sonde_knarre(); break; + default: + break; } } @@ -179,14 +181,11 @@ void Room3::sonde_knarre() { { { 4, 100, 180 }, 1, 3 }, { { 13, 45, 75 }, 1, 3 } }; - room_detail_info *rdi; - int16 tmp; - int16 ende; hide_cur(); - rdi = det->get_room_detail_info(); + room_detail_info *rdi = det->get_room_detail_info(); - det->load_taf_seq(162, 17, 0); - tmp = _G(zoom_horizont); + det->load_taf_seq(162, 17, nullptr); + int16 tmp = _G(zoom_horizont); _G(zoom_horizont) = 100; _G(auto_obj) = 1; mov_phasen[SONDE_OBJ].Lines = 3; @@ -195,14 +194,13 @@ void Room3::sonde_knarre() { auto_mov_obj[SONDE_OBJ].Id = AUTO_OBJ0; auto_mov_vector[SONDE_OBJ].Delay = _G(spieler).DelaySpeed; auto_mov_obj[SONDE_OBJ].Mode = true; - init_auto_obj(SONDE_OBJ, &SONDE_PHASEN[0][0], mov_phasen[SONDE_OBJ].Lines, (MovLine - *)sonde_mpkt1); + init_auto_obj(SONDE_OBJ, &SONDE_PHASEN[0][0], mov_phasen[SONDE_OBJ].Lines, (MovLine*)sonde_mpkt1); flags.AniUserAction = false; while (mov_phasen[SONDE_OBJ].Repeat != -1) set_ani_screen(); det->start_detail(SONDE_SHOOT, 1, ANI_VOR); - ende = 0; + int16 ende = 0; while (!ende) { clear_prog_ani(); if (rdi->Ainfo[SONDE_SHOOT].ani_count == 170) { @@ -261,8 +259,7 @@ void Room3::sonde_knarre() { mov_phasen[SONDE_OBJ].Lines = 2; mov_phasen[SONDE_OBJ].Repeat = 1; mov_phasen[SONDE_OBJ].ZoomFak = 28; - init_auto_obj(SONDE_OBJ, &SONDE_PHASEN[0][0], mov_phasen[SONDE_OBJ].Lines, (MovLine - *)sonde_mpkt2); + init_auto_obj(SONDE_OBJ, &SONDE_PHASEN[0][0], mov_phasen[SONDE_OBJ].Lines, (MovLine*)sonde_mpkt2); while (mov_phasen[SONDE_OBJ].Repeat != -1) set_ani_screen(); det->del_taf_tbl(162, 17, 0); @@ -273,11 +270,6 @@ void Room3::sonde_knarre() { } void Room3::probeTransfer() { - int16 tmp; - int16 i; - int16 spr_nr; - int16 anistart; - static const MovLine SONDE_MPKT1[2] = { { { 237, 52, 160 }, 0, 2 }, { { 144, 100, 180 }, 0, 2 } @@ -299,9 +291,9 @@ void Room3::probeTransfer() { flags.AniUserAction = false; hide_cur(); /*rdi = */(void)det->get_room_detail_info(); - tmp = _G(zoom_horizont); + int16 tmp = _G(zoom_horizont); _G(zoom_horizont) = 100; - anistart = false; + int16 anistart = false; _G(auto_obj) = 1; mov_phasen[SONDE_OBJ].Lines = 2; mov_phasen[SONDE_OBJ].Repeat = 1; @@ -309,8 +301,7 @@ void Room3::probeTransfer() { auto_mov_obj[SONDE_OBJ].Id = AUTO_OBJ0; auto_mov_vector[SONDE_OBJ].Delay = _G(spieler).DelaySpeed; auto_mov_obj[SONDE_OBJ].Mode = true; - init_auto_obj(SONDE_OBJ, &SONDE_PHASEN[0][0], mov_phasen[SONDE_OBJ].Lines, - (const MovLine *)SONDE_MPKT1); + init_auto_obj(SONDE_OBJ, &SONDE_PHASEN[0][0], mov_phasen[SONDE_OBJ].Lines, (const MovLine *)SONDE_MPKT1); while (mov_phasen[SONDE_OBJ].Repeat != -1) set_ani_screen(); @@ -327,8 +318,8 @@ void Room3::probeTransfer() { clear_prog_ani(); _G(auto_obj) = 2; - spr_nr = 140; - for (i = 0; i < 4 && !SHOULD_QUIT; i++) { + int16 spr_nr = 140; + for (int16 i = 0; i < 4 && !SHOULD_QUIT; i++) { mov_phasen[SONDE_OBJ].Lines = 2; mov_phasen[SONDE_OBJ].Repeat = 1; mov_phasen[SONDE_OBJ].ZoomFak = 0; @@ -391,7 +382,7 @@ void Room3::probeTransfer() { flags.AniUserAction = true; spr_nr = 141; _G(spieler).PersonHide[P_CHEWY] = true; - det->load_taf_seq(142, 8, 0); + det->load_taf_seq(142, 8, nullptr); break; case 1: @@ -399,7 +390,7 @@ void Room3::probeTransfer() { break; case 2: - det->del_taf_tbl(142, 7, 0); + det->del_taf_tbl(142, 7, nullptr); flags.AniUserAction = false; switch_room(2); break; diff --git a/engines/chewy/rooms/room31.cpp b/engines/chewy/rooms/room31.cpp index 0d11d0c2bd6..c74539f650c 100644 --- a/engines/chewy/rooms/room31.cpp +++ b/engines/chewy/rooms/room31.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room31.h" @@ -51,7 +50,7 @@ void Room31::surimy_go() { if (_G(spieler).R31SurimyGo >= 3) { hide_cur(); _G(spieler).R31SurimyGo = 0; - det->load_taf_seq(39, 8, 0); + det->load_taf_seq(39, 8, nullptr); _G(auto_obj) = 1; mov_phasen[SURIMY_OBJ].AtsText = 0; mov_phasen[SURIMY_OBJ].Lines = 2; @@ -60,8 +59,7 @@ void Room31::surimy_go() { auto_mov_obj[SURIMY_OBJ].Id = AUTO_OBJ0; auto_mov_vector[SURIMY_OBJ].Delay = _G(spieler).DelaySpeed + 2; auto_mov_obj[SURIMY_OBJ].Mode = true; - init_auto_obj(SURIMY_OBJ, &SURIMY_TAF19_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, - (const MovLine *)SURIMY_MPKT); + init_auto_obj(SURIMY_OBJ, &SURIMY_TAF19_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, (const MovLine *)SURIMY_MPKT); start_spz(CH_TALK5, 255, ANI_VOR, P_CHEWY); start_aad_wait(157, -1); wait_auto_obj(SURIMY_OBJ); @@ -74,10 +72,8 @@ void Room31::surimy_go() { } void Room31::calc_luke() { - int16 i; - if (!_G(spieler).R31KlappeZu) { - for (i = 0; i < 3; i++) + for (int16 i = 0; i < 3; i++) det->show_static_spr(5 + i); atds->set_ats_str(244, 1, ATS_DATEI); @@ -85,7 +81,7 @@ void Room31::calc_luke() { _G(spieler).room_e_obj[75].Attribut = AUSGANG_UNTEN; } else { - for (i = 0; i < 3; i++) + for (int16 i = 0; i < 3; i++) det->hide_static_spr(5 + i); atds->set_ats_str(244, 0, ATS_DATEI); @@ -196,7 +192,7 @@ void Room31::close_luke() { if (!_G(spieler).R31KlappeZu) { hide_cur(); auto_move(2, P_CHEWY); - start_spz_wait(13, 1, 0, 0); + start_spz_wait(13, 1, false, P_CHEWY); _G(spieler).R31KlappeZu = true; det->play_sound(3, 0); det->play_sound(3, 1); diff --git a/engines/chewy/rooms/room33.cpp b/engines/chewy/rooms/room33.cpp index 71d18d7fbcc..eba7d58dff7 100644 --- a/engines/chewy/rooms/room33.cpp +++ b/engines/chewy/rooms/room33.cpp @@ -22,8 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" -#include "chewy/room.h" #include "chewy/room.h" #include "chewy/rooms/room33.h" @@ -50,7 +48,7 @@ void Room33::surimy_go() { if (_G(spieler).R33SurimyGo >= 4) { hide_cur(); _G(spieler).R33SurimyGo = 0; - det->load_taf_seq(39, 8, 0); + det->load_taf_seq(39, 8, nullptr); _G(auto_obj) = 1; mov_phasen[SURIMY_OBJ].AtsText = 0; mov_phasen[SURIMY_OBJ].Lines = 2; @@ -59,8 +57,7 @@ void Room33::surimy_go() { auto_mov_obj[SURIMY_OBJ].Id = AUTO_OBJ0; auto_mov_vector[SURIMY_OBJ].Delay = _G(spieler).DelaySpeed + 2; auto_mov_obj[SURIMY_OBJ].Mode = true; - init_auto_obj(SURIMY_OBJ, &SURIMY_TAF19_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, - (const MovLine *)SURIMY_MPKT); + init_auto_obj(SURIMY_OBJ, &SURIMY_TAF19_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, (const MovLine *)SURIMY_MPKT); start_spz(CH_TALK5, 255, ANI_VOR, P_CHEWY); start_aad_wait(158, -1); wait_auto_obj(SURIMY_OBJ); @@ -105,12 +102,10 @@ int16 Room33::use_schublade() { } void Room33::use_maschine() { - int16 action; int16 dia_nr; int16 ani_nr; - int16 hocker; - action = true; - hocker = false; + int16 action = true; + int16 hocker = false; hide_cur(); if (!_G(spieler).R33MunterOk) { @@ -194,11 +189,9 @@ void Room33::use_maschine() { } int16 Room33::calc_muntermacher() { - int16 ret; - int16 i; - ret = true; + int16 ret = true; - for (i = 0; i < 4; i++) { + for (int16 i = 0; i < 4; i++) { if (_G(spieler).R33Munter[i] == false) ret = false; } diff --git a/engines/chewy/rooms/room39.cpp b/engines/chewy/rooms/room39.cpp index 496741484b7..c26e8ca97da 100644 --- a/engines/chewy/rooms/room39.cpp +++ b/engines/chewy/rooms/room39.cpp @@ -71,11 +71,11 @@ void Room39::entry() { } short Room39::use_howard() { - int16 dia_nr = -1; int16 ani_nr = 0; int16 action_flag = false; if (!_G(spieler).R39HowardWach) { + int16 dia_nr; if (_G(spieler).inv_cur) { if (is_cur_inventar(MANUSKRIPT_INV)) { hide_cur(); @@ -165,13 +165,12 @@ void Room39::ok() { } int16 Room39::use_tv() { - int16 cls_flag; int16 dia_nr = -1; int16 ani_nr = -1; int16 action_flag = false; auto_move(2, P_CHEWY); - cls_flag = false; + int16 cls_flag = false; hide_cur(); if (is_cur_inventar(ZAPPER_INV)) { @@ -180,7 +179,7 @@ int16 Room39::use_tv() { _G(spieler).R39TvKanal = -1; flags.NoPalAfterFlc = true; - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); flic_cut(FCUT_042, FLC_MODE); ++_G(spieler).R39TvKanal; @@ -215,14 +214,14 @@ int16 Room39::use_tv() { flic_cut(FCUT_041, FLC_MODE); _G(spieler).R39TvKanal = 0; _G(spieler).R39ClintNews = 0; - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); out->set_palette(pal); flags.NoPalAfterFlc = true; flic_cut(TV_FLIC[0], FLC_MODE); out->cls(); - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); out->set_palette(pal); set_tv(); @@ -262,7 +261,7 @@ int16 Room39::use_tv() { if (cls_flag) { out->cls(); - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); out->set_palette(pal); flags.NoPalAfterFlc = false; @@ -280,13 +279,12 @@ int16 Room39::use_tv() { } void Room39::look_tv(int16 cls_mode) { - int16 flic_nr; - int16 dia_nr; - _flag = false; if (_G(spieler).R39TvOn) { if (!flags.AutoAniPlay) { + int16 flic_nr; + int16 dia_nr; if (!_G(spieler).R39TvKanal && _G(spieler).R39ClintNews < 3) { flic_nr = FCUT_038; ++_G(spieler).R39ClintNews; @@ -299,7 +297,7 @@ void Room39::look_tv(int16 cls_mode) { } if (cls_mode) { - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); out->set_palette(pal); flags.NoPalAfterFlc = true; @@ -318,7 +316,7 @@ void Room39::look_tv(int16 cls_mode) { if (cls_mode) { out->cls(); - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); out->set_palette(pal); flags.NoPalAfterFlc = false; @@ -334,9 +332,7 @@ void Room39::look_tv(int16 cls_mode) { } void Room39::set_tv() { - int16 i; - - for (i = 0; i < 6; i++) + for (int16 i = 0; i < 6; i++) det->hide_static_spr(i + 4); if (_G(spieler).R39TvOn) { diff --git a/engines/chewy/rooms/room4.cpp b/engines/chewy/rooms/room4.cpp index 7b84d10a2e4..3d599925746 100644 --- a/engines/chewy/rooms/room4.cpp +++ b/engines/chewy/rooms/room4.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room4.h" @@ -35,11 +34,6 @@ namespace Rooms { #define RAHMEN_GELB 71 int16 Room4::sonde_comp() { - int16 ende; - - int16 spr_nr; - int16 cur_x; - static const int16 CUR_POS[3][2] = { { 83, 106 }, { 136, 103 }, @@ -56,10 +50,10 @@ int16 Room4::sonde_comp() { _G(cur_display) = false; switch_room(4); _G(cur_display) = true; - ende = 0; + int16 ende = 0; curblk.sprite = room_blk.DetImage; - cur_x = 1; - spr_nr = RAHMEN_ROT; + int16 cur_x = 1; + int16 spr_nr = RAHMEN_ROT; cur->move(160, 160); start_aad(46); @@ -89,6 +83,8 @@ int16 Room4::sonde_comp() { det->play_sound(0, 2); break; + default: + break; } } spr_info[0].Image = room_blk.DetImage[spr_nr]; @@ -126,7 +122,8 @@ int16 Room4::sonde_comp() { _G(spieler).PersonRoomNr[P_CHEWY] = 3; room->load_room(&room_blk, _G(spieler).PersonRoomNr[P_CHEWY], &_G(spieler)); ERROR - fx_blend = BLEND1; + + fx_blend = BLEND1; atds->stop_aad(); return cur_x; diff --git a/engines/chewy/rooms/room40.cpp b/engines/chewy/rooms/room40.cpp index fbae1fe5e6f..94592c011ed 100644 --- a/engines/chewy/rooms/room40.cpp +++ b/engines/chewy/rooms/room40.cpp @@ -82,7 +82,8 @@ void Room40::entry(int16 eib_nr) { case 87: set_person_pos(158, 93, P_HOWARD, P_LEFT); break; - + default: + break; } } } @@ -155,9 +156,6 @@ bool Room40::timer(int16 t_nr, int16 ani_nr) { } void Room40::move_train(int16 mode) { - int16 lx, ax; - int16 delay; - _G(spieler).R40TrainMove = false; hide_cur(); auto_move(9, P_CHEWY); @@ -167,8 +165,8 @@ void Room40::move_train(int16 mode) { if (!mode) start_aad_wait(206, -1); - lx = -40; - ax = lx - 190; + int16 lx = -40; + int16 ax = lx - 190; det->start_detail(7, 20, ANI_VOR); det->show_static_spr(11); @@ -177,7 +175,7 @@ void Room40::move_train(int16 mode) { det->show_static_spr(12); det->enable_sound(7, 0); - delay = 0; + int16 delay = 0; while (ax < 560) { det->set_detail_pos(7, lx, 46); @@ -212,15 +210,11 @@ void Room40::move_train(int16 mode) { } void Room40::setup_func() { - int16 x, y; - int16 sp_x; - if (!_G(spieler).R40HoUse && _G(spieler).PersonRoomNr[P_HOWARD] == 40) { calc_person_look(); - x = spieler_vector[P_HOWARD].Xypos[0]; - y = spieler_vector[P_HOWARD].Xypos[1]; - sp_x = spieler_vector[P_CHEWY].Xypos[0]; + int16 x, y; + const int16 sp_x = spieler_vector[P_CHEWY].Xypos[0]; if (sp_x > 170 && sp_x < 255) { x = 248; y = 97; @@ -233,6 +227,9 @@ void Room40::setup_func() { } else if (sp_x < 170) { x = 165; y = 99; + } else { + x = spieler_vector[P_HOWARD].Xypos[0]; + y = spieler_vector[P_HOWARD].Xypos[1]; } go_auto_xy(x, y, P_HOWARD, ANI_GO); @@ -415,8 +412,7 @@ int16 Room40::use_schalter(int16 aad_nr) { } void Room40::talk_police() { - if (_G(spieler).R40PoliceWeg == false && - _G(spieler).R40PoliceAniStatus == 255) { + if (_G(spieler).R40PoliceWeg == false && _G(spieler).R40PoliceAniStatus == 255) { hide_cur(); _G(spieler).R40PoliceStart = false; room->set_timer_status(255, TIMER_STOP); @@ -481,7 +477,7 @@ int16 Room40::use_haendler() { _G(spieler).R40Wettbewerb = true; _G(spieler).PersonRoomNr[P_HOWARD] = 28; flags.NoScroll = false; - out->setze_zeiger(0); + out->setze_zeiger(nullptr); out->cls(); switch_room(28); SetUpScreenFunc = setup_func; @@ -567,8 +563,7 @@ bool Room40::use_police() { bool result = false; if (menu_item == CUR_HOWARD) { - if (_G(spieler).R40PoliceWeg == false && - _G(spieler).R40PoliceAniStatus == 255) { + if (_G(spieler).R40PoliceWeg == false && _G(spieler).R40PoliceAniStatus == 255) { result = true; _G(spieler).R40PoliceAb = true; hide_cur(); @@ -596,9 +591,6 @@ bool Room40::use_police() { } int16 Room40::use_tele() { - int16 dia_nr = -1; - int16 dia_nr1 = -1; - int16 timer_wert; int16 action_flag = false; if (!_G(spieler).inv_cur) { @@ -606,6 +598,7 @@ int16 Room40::use_tele() { action_flag = true; hide_cur(); + int16 dia_nr1 = -1; if (!_G(spieler).R40PoliceAb) { start_aad_wait(219, -1); _G(spieler).R40HoUse = false; @@ -614,6 +607,7 @@ int16 Room40::use_tele() { auto_move(13, P_CHEWY); det->show_static_spr(0); + int16 dia_nr; if (!_G(spieler).R40DuengerMit) { dia_nr = 220; dia_nr1 = 222; @@ -628,7 +622,7 @@ int16 Room40::use_tele() { auto_move(9, P_CHEWY); start_aad_wait(dia_nr1, -1); _G(spieler).R40HoUse = false; - timer_wert = 0; + int16 timer_wert = 0; if (dia_nr1 == 223) { if (is_cur_inventar(DUENGER_INV)) { diff --git a/engines/chewy/rooms/room45.cpp b/engines/chewy/rooms/room45.cpp index ece222cfb28..1838327e60f 100644 --- a/engines/chewy/rooms/room45.cpp +++ b/engines/chewy/rooms/room45.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room45.h" @@ -30,9 +29,6 @@ namespace Chewy { namespace Rooms { void Room45::entry(int16 eib_nr) { - int16 ch_x, ch_y; - int16 ho_x, ho_y; - _G(spieler).ScrollxStep = 2; SetUpScreenFunc = setup_func; _G(r45_delay) = 0; @@ -49,6 +45,8 @@ void Room45::entry(int16 eib_nr) { spieler_mi[P_HOWARD].Mode = true; if (!flags.LoadGame) { + int16 ch_x, ch_y; + int16 ho_x, ho_y; if (_G(spieler).R48TaxiEntry) { ch_x = 67; ch_y = 146; @@ -94,16 +92,14 @@ void Room45::xit(int16 eib_nr) { } void Room45::setup_func() { - int16 i; int16 x; int16 y; - int16 ch_x; if (menu_display == 0) { if (!_G(r45_delay)) { _G(r45_delay) = _G(spieler).DelaySpeed / 2; - for (i = 0; i < MAX_PERSON; i++) { + for (int16 i = 0; i < MAX_PERSON; i++) { if (_G(r45_pinfo)[i][0] == 1) { y = Adi[3 + i].y; x = Adi[3 + i].x; @@ -145,9 +141,7 @@ void Room45::setup_func() { if (_G(spieler).PersonRoomNr[P_HOWARD] == 45 && HowardMov != 2) { calc_person_look(); - x = spieler_vector[P_HOWARD].Xypos[0]; - y = 64; - ch_x = spieler_vector[P_CHEWY].Xypos[0]; + const int16 ch_x = spieler_vector[P_CHEWY].Xypos[0]; if (ch_x < 95) { x = 18; diff --git a/engines/chewy/rooms/room46.cpp b/engines/chewy/rooms/room46.cpp index 2dc63021ea2..8f3a4a1499f 100644 --- a/engines/chewy/rooms/room46.cpp +++ b/engines/chewy/rooms/room46.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room46.h" @@ -77,15 +76,11 @@ void Room46::xit() { } void Room46::setup_func() { - int16 x; - int16 y; - int16 ch_x; - calc_person_look(); - x = spieler_vector[P_HOWARD].Xypos[0]; - y = 64; - ch_x = spieler_vector[P_CHEWY].Xypos[0]; + int16 y = 64; + const int16 ch_x = spieler_vector[P_CHEWY].Xypos[0]; + int16 x; if (ch_x > 160) { x = 260; } else { @@ -151,17 +146,14 @@ void Room46::bodo() { } void Room46::kloppe() { - int16 i; - int16 delay; - - for (i = 0; i < 4; i++) { + for (int16 i = 0; i < 4; i++) { mem->file->select_pool_item(Ci.Handle, FCUT_065); flc->play(Ci.Handle, Ci.VirtScreen, Ci.TempArea); out->setze_zeiger(nullptr); out->cls(); start_aad(244 + i, -1); - delay = _G(spieler).DelaySpeed * 50; + int16 delay = _G(spieler).DelaySpeed * 50; atds->print_aad(0, 0); while (in->get_switch_code() == 0 && delay) { diff --git a/engines/chewy/rooms/room47.cpp b/engines/chewy/rooms/room47.cpp index 78c94bc4584..e4c1f8b2392 100644 --- a/engines/chewy/rooms/room47.cpp +++ b/engines/chewy/rooms/room47.cpp @@ -22,8 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" -#include "chewy/room.h" #include "chewy/rooms/room47.h" namespace Chewy { diff --git a/engines/chewy/rooms/room48.cpp b/engines/chewy/rooms/room48.cpp index 10539e01184..27698d9c201 100644 --- a/engines/chewy/rooms/room48.cpp +++ b/engines/chewy/rooms/room48.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room48.h" @@ -49,9 +48,7 @@ bool Room48::timer(int16 t_nr, int16 ani_nr) { } void Room48::calc_pic() { - int16 i; - - for (i = 0; i < 2; i++) { + for (int16 i = 0; i < 2; i++) { atds->set_steuer_bit(312 + i, ATS_AKTIV_BIT, ATS_DATEI); _G(spieler).R48Auswahl[3 + i] = 0; } @@ -88,28 +85,22 @@ void Room48::frage() { } void Room48::setup_func() { - int16 idx; - int16 r_nr; - int16 i; - - for (i = 0; i < 5; i++) + for (int16 i = 0; i < 5; i++) det->hide_static_spr(1 + i); if (flags.ShowAtsInvTxt) { if (menu_display == 0) { - if (menu_item != CUR_USE) { - menu_item = CUR_USE; - } - + menu_item = CUR_USE; cur_2_inventory(); cursor_wahl(CUR_ZEIGE); - idx = det->maus_vector(minfo.x, minfo.y); + const int16 idx = det->maus_vector(minfo.x, minfo.y); if (idx != -1) { if (_G(spieler).R48Auswahl[idx]) { det->show_static_spr(1 + idx); if (_G(maus_links_click)) { + int16 r_nr; switch (idx) { case 0: r_nr = 45; @@ -153,7 +144,7 @@ void Room48::setup_func() { _G(maus_links_click) = false; set_up_screen(DO_SETUP); - for (i = 0; i < MAX_PERSON; i++) { + for (int16 i = 0; i < MAX_PERSON; i++) { if (_G(spieler).R48TaxiPerson[i]) { _G(spieler).PersonHide[i] = false; _G(spieler).R48TaxiPerson[i] = false; diff --git a/engines/chewy/rooms/room49.cpp b/engines/chewy/rooms/room49.cpp index 54bc9e657ca..3476c3c8738 100644 --- a/engines/chewy/rooms/room49.cpp +++ b/engines/chewy/rooms/room49.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room49.h" @@ -176,7 +175,7 @@ void Room49::use_boy_cigar() { SetUpScreenFunc = nullptr; auto_move(5, P_CHEWY); - int16 zoom = room->room_info->ZoomFak; + const int16 zoom = room->room_info->ZoomFak; room->set_zoom(zoom); go_auto_xy(416, 79, P_HOWARD, ANI_VOR); set_person_spr(P_LEFT, P_HOWARD); @@ -270,15 +269,11 @@ int16 Room49::use_taxi() { } void Room49::setup_func() { - int16 x, y; - int16 ch_x; - if (_G(spieler).PersonRoomNr[P_HOWARD] == 49) { calc_person_look(); - x = spieler_vector[P_HOWARD].Xypos[0]; - y = 64; - ch_x = spieler_vector[P_CHEWY].Xypos[0]; + const int16 ch_x = spieler_vector[P_CHEWY].Xypos[0]; + int16 x, y; if (ch_x < 130) { x = 40; y = 97; diff --git a/engines/chewy/rooms/room50.cpp b/engines/chewy/rooms/room50.cpp index 6ad57b8e6db..1609aeebf3b 100644 --- a/engines/chewy/rooms/room50.cpp +++ b/engines/chewy/rooms/room50.cpp @@ -246,9 +246,6 @@ void Room50::aad_page(int16 aad_nr, int16 ani_nr) { } void Room50::setup_func() { - int16 x, y; - int16 ch_x; - if (_wasser && !det->get_ani_status(4)) { _wasser = false; go_page(); @@ -256,10 +253,9 @@ void Room50::setup_func() { if (_G(spieler).PersonRoomNr[P_HOWARD] == 50) { calc_person_look(); - x = spieler_vector[P_HOWARD].Xypos[0]; - y = 64; - ch_x = spieler_vector[P_CHEWY].Xypos[0]; + const int16 ch_x = spieler_vector[P_CHEWY].Xypos[0]; + int16 x, y; if (ch_x < 72) { x = 1; y = 64; diff --git a/engines/chewy/rooms/room68.cpp b/engines/chewy/rooms/room68.cpp index 3213ea9af2a..9be2dfdc311 100644 --- a/engines/chewy/rooms/room68.cpp +++ b/engines/chewy/rooms/room68.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room68.h" @@ -80,10 +79,6 @@ bool Room68::timer(int16 t_nr, int16 ani_nr) { } void Room68::setup_func() { - int16 ho_x, ho_y; - int16 ni_x, ni_y; - int16 ch_x; - switch (_G(r68HohesC)) { case 0: if (det->get_ani_status(_G(r68HohesC)) == false) { @@ -108,13 +103,15 @@ void Room68::setup_func() { } break; + default: + break; } calc_person_look(); - ho_x = spieler_vector[P_HOWARD].Xypos[0]; - ni_x = spieler_vector[P_NICHELLE].Xypos[0]; - ho_y = 75; - ni_y = 75; - ch_x = spieler_vector[P_CHEWY].Xypos[0]; + int16 ho_y = 75; + int16 ni_y = 75; + int16 ch_x = spieler_vector[P_CHEWY].Xypos[0]; + int16 ho_x, ni_x; + if (ch_x < 130) { ho_x = 223; ni_x = 260; @@ -282,17 +279,17 @@ int16 Room68::use_keeper() { } int16 Room68::use_diva() { - short action_flag = false; + int16 action_flag; hide_cur(); if (is_cur_inventar(B_MARY_INV)) { del_inventar(_G(spieler).AkInvent); - action_flag = true; + action_flag = 1; auto_move(4, P_CHEWY); start_detail_wait(4, 1, ANI_VOR); _G(spieler).R68Gutschein = false; } else if (is_cur_inventar(B_MARY2_INV)) { del_inventar(_G(spieler).AkInvent); - action_flag = true; + action_flag = 1; auto_move(4, P_CHEWY); det->hide_static_spr(3); _G(spieler).R68DivaWeg = true; diff --git a/engines/chewy/rooms/room7.cpp b/engines/chewy/rooms/room7.cpp index f78f63340b9..860465f685a 100644 --- a/engines/chewy/rooms/room7.cpp +++ b/engines/chewy/rooms/room7.cpp @@ -23,7 +23,6 @@ #include "chewy/events.h" #include "chewy/global.h" #include "chewy/ani_dat.h" -#include "chewy/room.h" #include "chewy/rooms/room7.h" namespace Chewy { @@ -128,7 +127,7 @@ void Room7::klingel() { start_aad(7, 0); start_ani_block(3, ABLOCK25); det->show_static_spr(7); - det->load_taf_seq(192, 74, 0); + det->load_taf_seq(192, 74, nullptr); det->start_detail(14, 1, ANI_VOR); set_person_pos(95, 94, P_CHEWY, P_RIGHT); det->stop_detail(5); diff --git a/engines/chewy/rooms/room8.cpp b/engines/chewy/rooms/room8.cpp index 2ac24f520ca..53f86f788c8 100644 --- a/engines/chewy/rooms/room8.cpp +++ b/engines/chewy/rooms/room8.cpp @@ -113,7 +113,7 @@ void Room8::start_verbrennen() { bool Room8::gips_wurf() { if (is_cur_inventar(GIPS_EIMER_INV)) { hide_cur(); - det->load_taf_seq(116, 30, 0); + det->load_taf_seq(116, 30, nullptr); auto_move(2, P_CHEWY); _G(maus_links_click) = false; @@ -165,11 +165,11 @@ void Room8::open_gdoor() { } void Room8::talk_nimoy() { - int16 tmp; auto_move(9, P_CHEWY); flags.NoScroll = true; auto_scroll(0, 120); if (_G(spieler).R8Folter) { + int16 tmp; if (!_G(spieler).R8GipsWurf) tmp = 1; else diff --git a/engines/chewy/rooms/room80.cpp b/engines/chewy/rooms/room80.cpp index 70c19a0d4e5..f58eb0a0a1e 100644 --- a/engines/chewy/rooms/room80.cpp +++ b/engines/chewy/rooms/room80.cpp @@ -22,8 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" -#include "chewy/room.h" #include "chewy/rooms/room80.h" namespace Chewy { @@ -77,9 +75,7 @@ void Room80::setup_func() { if (_G(spieler).flags32_1 || !flags.ShowAtsInvTxt || menu_display) return; - if (menu_item != CUR_USE) - menu_item = CUR_USE; - + menu_item = CUR_USE; cur_2_inventory(); cursor_wahl(CUR_ZEIGE); int vec = det->maus_vector(_G(spieler).scrollx + minfo.x, minfo.y); diff --git a/engines/chewy/rooms/room9.cpp b/engines/chewy/rooms/room9.cpp index 91833b74dd5..51c5f63f150 100644 --- a/engines/chewy/rooms/room9.cpp +++ b/engines/chewy/rooms/room9.cpp @@ -22,7 +22,6 @@ #include "chewy/defines.h" #include "chewy/events.h" #include "chewy/global.h" -#include "chewy/ani_dat.h" #include "chewy/room.h" #include "chewy/rooms/room9.h" @@ -74,10 +73,9 @@ void Room9::gtuer() { } void Room9::surimy() { - int16 tmp; hide_cur(); _G(spieler).R9Surimy = true; - tmp = spieler_vector[P_CHEWY].Count; + const int16 tmp = spieler_vector[P_CHEWY].Count; stop_person(P_CHEWY); atds->set_steuer_bit(75, ATS_AKTIV_BIT, ATS_DATEI); det->hide_static_spr(4); @@ -93,7 +91,7 @@ void Room9::surimy() { } void Room9::surimy_ani() { - det->load_taf_seq(91, 8, 0); + det->load_taf_seq(91, 8, nullptr); _G(auto_obj) = 1; mov_phasen[SURIMY_OBJ].AtsText = 0; mov_phasen[SURIMY_OBJ].Lines = 2; @@ -102,8 +100,7 @@ void Room9::surimy_ani() { auto_mov_obj[SURIMY_OBJ].Id = AUTO_OBJ0; auto_mov_vector[SURIMY_OBJ].Delay = _G(spieler).DelaySpeed; auto_mov_obj[SURIMY_OBJ].Mode = true; - init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, - (const MovLine *)SURIMY_MPKT); + init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, (const MovLine *)SURIMY_MPKT); wait_auto_obj(SURIMY_OBJ); start_detail_frame(0, 1, ANI_VOR, 15); det->start_detail(2, 1, ANI_VOR); @@ -112,8 +109,7 @@ void Room9::surimy_ani() { start_spz(CH_EKEL, 2, ANI_VOR, P_CHEWY); det->hide_static_spr(4); mov_phasen[SURIMY_OBJ].Repeat = 1; - init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, - (const MovLine *)SURIMY_MPKT1); + init_auto_obj(SURIMY_OBJ, &SURIMY_PHASEN[0][0], mov_phasen[SURIMY_OBJ].Lines, (const MovLine *)SURIMY_MPKT1); wait_auto_obj(SURIMY_OBJ); det->del_taf_tbl(91, 8, 0); } @@ -122,7 +118,7 @@ void Room9::gedAction(int index) { switch (index) { case 0: if (!_G(spieler).R9Surimy) - Room9::surimy(); + surimy(); break; default: