scummvm/engines/chewy/room.cpp

569 lines
14 KiB
C++
Raw Normal View History

2019-11-04 21:24:37 +00:00
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
2021-12-26 23:54:17 +00:00
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
2019-11-04 21:24:37 +00:00
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2021-12-26 23:54:17 +00:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2019-11-04 21:24:37 +00:00
*
*/
2021-09-12 03:13:53 +00:00
#include "chewy/defines.h"
#include "chewy/globals.h"
#include "chewy/resource.h"
2021-09-12 03:13:53 +00:00
#include "chewy/room.h"
#include "chewy/ngshext.h"
2019-11-04 21:24:37 +00:00
2021-09-12 22:41:09 +00:00
namespace Chewy {
2022-01-07 06:41:21 +00:00
const int16 SURIMY_TAF19_PHASEN[4][2] = {
{ 0, 0 },
{ 39, 46 },
{ 0, 0 },
{ 0, 0 }
};
static const uint8 CHEWY_PHASEN[8][8] = {
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 8, 9, 10, 11, 12, 13, 14, 15 },
{ 16, 17, 18, 19, 20, 21, 22, 23 },
{ 24, 25, 26, 27, 28, 29, 30, 31 },
{ 32, 33, 34, 33, 32 },
{ 35, 36, 37, 38, 39, 40, 41, 42 },
{ 43, 44, 45, 46, 47, 48, 49, 50 },
{ 51, 52, 53, 52, 51 }
};
static const uint8 CHEWY_PHASEN_ANZ[] = { 8, 8, 8, 8, 5, 8, 8, 5 };
static const uint8 CHEWY_BO_PHASEN[8][8] = {
{ 0, 1, 2, 3, 4, 5 },
{ 6, 7, 8, 9, 10, 11 },
{ 12, 13, 14, 15, 16, 17 },
{ 12, 13, 14, 15, 16, 17 },
{ 18, 19, 20, 19, 18 },
{ 21, 22, 23, 24, 25, 26 },
{ 21, 22, 23, 24, 25, 26 },
{ 27, 28, 29, 28, 27 }
};
static const uint8 CHEWY_BO_PHASEN_ANZ[] = { 6, 6, 6, 6, 5, 6, 6, 5 };
static const uint8 CHEWY_MI_PHASEN[8][8] = {
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 8, 9, 10, 11, 12, 13, 14, 15 },
{ 24, 25, 26, 27, 28, 29, 30, 31 },
{ 24, 25, 26, 27, 28, 29, 30, 31 },
{ 32, 33, 34, 33, 32 },
{ 16, 17, 18, 19, 20, 21, 22, 23 },
{ 16, 17, 18, 19, 20, 21, 22, 23 },
{ 35, 36, 37, 36, 35 }
};
static const uint8 CHEWY_MI_PHASEN_ANZ[] = { 8, 8, 8, 8, 5, 8, 8, 5 };
static const uint8 CHEWY_RO_PHASEN[8][8] = {
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 8, 9, 10, 11, 12, 13, 14, 15 },
{ 24, 25, 26, 27, 28, 29, 30, 31 },
{ 24, 25, 26, 27, 28, 29, 30, 31 },
{ 32, 33, 34, 35, 36, 35, 34, 33 },
{ 16, 17, 18, 19, 20, 21, 22, 23 },
{ 16, 17, 18, 19, 20, 21, 22, 23 },
{ 37, 38, 39, 40, 41, 40, 39, 38 }
};
static const uint8 CHEWY_RO_PHASEN_ANZ[] = { 8, 8, 8, 8, 8, 8, 8, 8 };
static const uint8 CHEWY_JM_PHASEN[8][8] = {
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 8, 9, 10, 11, 12, 13, 14, 15 },
{ 16, 17, 18, 19, 20, 21, 22, 23 },
{ 16, 17, 18, 19, 20, 21, 22, 23 },
{ 24, 25, 26, 27, 27, 26, 25, 24 },
{ 8, 9, 10, 11, 12, 13, 14, 15 },
{ 8, 9, 10, 11, 12, 13, 14, 15 },
{ 28, 29, 30, 31, 31, 30, 29, 28 }
};
void JungleRoom::topEntry() {
_G(cur_hide_flag) = 0;
2022-02-22 08:03:00 +00:00
hideCur();
2022-03-01 22:49:01 +00:00
setPersonPos(236, 110, P_CHEWY, P_RIGHT);
setPersonPos(263, 85, P_NICHELLE, P_RIGHT);
setPersonPos(285, 78, P_HOWARD, P_RIGHT);
2022-02-26 23:57:27 +00:00
goAutoXy(266, 113, P_HOWARD, ANI_WAIT);
2022-02-22 08:03:00 +00:00
showCur();
}
void JungleRoom::leftEntry() {
2022-03-01 22:49:01 +00:00
setPersonPos(31, 118, P_CHEWY, P_RIGHT);
setPersonPos(71, 104, P_NICHELLE, P_RIGHT);
setPersonPos(6, 111, P_HOWARD, P_RIGHT);
}
void JungleRoom::rightEntry() {
2022-03-01 22:49:01 +00:00
setPersonPos(587, 114, P_CHEWY, P_LEFT);
setPersonPos(613, 103, P_NICHELLE, P_LEFT);
setPersonPos(561, 112, P_HOWARD, P_LEFT);
}
void JungleRoom::setup_func() {
calc_person_look();
const int posX = _G(spieler_vector)[P_CHEWY].Xypos[0];
int howDestX, nicDestX;
if (posX < 40) {
howDestX = 52;
nicDestX = 100;
} else if (posX < 230) {
howDestX = 83;
nicDestX = 163;
} else if (posX < 445) {
howDestX = 261;
nicDestX = 329;
} else {
howDestX = 493;
nicDestX = 543;
}
2022-02-26 23:57:27 +00:00
goAutoXy(howDestX, 111, P_HOWARD, ANI_GO);
goAutoXy(nicDestX, 110, P_NICHELLE, ANI_GO);
}
2019-11-04 21:24:37 +00:00
Room::Room() {
2022-02-11 04:56:57 +00:00
_roomTimer.TimerAnz = 0;
_roomTimer.TimerStart = 0;
2019-11-04 21:24:37 +00:00
init_ablage();
for (int16 i = 0; i < MAX_ROOM_HANDLE; i++)
2022-02-11 04:56:57 +00:00
_roomHandle[i] = 0;
2019-11-04 21:24:37 +00:00
}
2022-02-21 00:02:27 +00:00
2019-11-04 21:24:37 +00:00
Room::~Room() {
for (int16 i = 0; i < MAX_ROOM_HANDLE; i++)
2022-02-11 04:56:57 +00:00
if (_roomHandle[i])
2022-02-21 00:00:38 +00:00
delete _roomHandle[i];
2019-11-04 21:24:37 +00:00
free_ablage();
}
Stream *Room::open_handle(const char *fname1, int16 mode) {
2022-02-21 00:00:38 +00:00
Common::File *f = new Common::File();
f->open(fname1);
if (f->isOpen()) {
if (_roomHandle[mode])
delete _roomHandle[mode];
_roomHandle[mode] = f;
2019-11-04 21:24:37 +00:00
} else {
error("open_handle error");
2019-11-04 21:24:37 +00:00
}
2021-09-14 01:52:40 +00:00
2022-02-11 04:56:57 +00:00
return _roomHandle[mode];
2019-11-04 21:24:37 +00:00
}
2022-03-02 22:42:15 +00:00
void Room::loadRoom(RaumBlk *Rb, int16 room_nr, Spieler *player) {
2019-11-04 21:24:37 +00:00
clear_prog_ani();
_G(det)->load_rdi(Rb->DetFile, room_nr);
2019-11-04 21:24:37 +00:00
if (player->SoundSwitch == false)
_G(det)->disable_room_sound();
RoomDetailInfo *Rdi_ = _G(det)->getRoomDetailInfo();
_roomInfo = &Rdi_->Ri;
if (_roomInfo->TafLoad != 255) {
char tmp_str[MAXPATH];
strcpy(tmp_str, Rb->RoomDir);
strcat(tmp_str, _roomInfo->TafName);
_G(det)->load_rdi_taf(tmp_str, _roomInfo->TafLoad);
Rb->Fti = _G(det)->get_taf_info();
2022-03-02 22:42:15 +00:00
Rb->_detImage = Rb->Fti->_image;
2022-02-27 19:00:54 +00:00
Rb->DetKorrekt = Rb->Fti->_correction;
2019-11-04 21:24:37 +00:00
}
_G(obj)->calc_all_static_detail();
load_tgp(_roomInfo->BildNr, Rb, EPISODE1_TGP, GED_LOAD, "back/episode1.tgp");
set_pal(_ablagePal[Rb->AkAblage], Rb->LowPalMem);
calc_invent(Rb, player);
del_timer_old_room();
add_timer_new_room();
if (Rb->AtsLoad)
2022-02-28 21:45:53 +00:00
_G(atds)->load_atds(_roomInfo->_roomNr, ATS_DATA);
if (Rb->AadLoad)
2022-02-28 21:45:53 +00:00
_G(atds)->load_atds(_roomInfo->_roomNr, AAD_DATA);
2019-11-04 21:24:37 +00:00
}
void Room::set_timer_start(int16 timer_start) {
2022-02-11 04:56:57 +00:00
_roomTimer.TimerStart = timer_start;
2019-11-04 21:24:37 +00:00
}
void Room::add_timer_new_room() {
2022-02-11 04:56:57 +00:00
_roomTimer.TimerAnz = 0;
2019-11-04 21:24:37 +00:00
2022-02-11 04:56:57 +00:00
for (int i = 0; i < MAXDETAILS && _roomTimer.TimerAnz < MAX_ROOM_TIMER; i++) {
AniDetailInfo *adi = _G(det)->getAniDetail(i);
2019-11-04 21:24:37 +00:00
if (adi->timer_start != 0) {
set_timer(i, adi->timer_start);
2021-10-26 02:16:34 +00:00
} else if (adi->start_flag || adi->repeat) {
2022-03-01 22:49:01 +00:00
_G(det)->startDetail(i, 0, ANI_FRONT);
2019-11-04 21:24:37 +00:00
}
}
}
void Room::del_timer_old_room() {
2022-02-11 04:56:57 +00:00
for (int i = 0; i < _roomTimer.TimerAnz; i++) {
2022-02-27 22:22:24 +00:00
_G(uhr)->setStatus(_roomTimer.TimerNr[i], TIMER_STOP);
2019-11-04 21:24:37 +00:00
}
2022-02-11 04:56:57 +00:00
_roomTimer.TimerAnz = 0;
2019-11-04 21:24:37 +00:00
}
int16 Room::set_timer(int16 ani_nr, int16 timer_end) {
2022-02-11 04:56:57 +00:00
int16 timer_nr_ = _roomTimer.TimerStart + _roomTimer.TimerAnz;
2022-02-27 22:22:24 +00:00
int16 ret = _G(uhr)->setNewTimer(timer_nr_, timer_end, SEC_MODE);
2019-11-04 21:24:37 +00:00
if (ret != -1) {
2022-02-11 04:56:57 +00:00
_roomTimer.ObjNr[_roomTimer.TimerAnz] = ani_nr;
_roomTimer.TimerNr[_roomTimer.TimerAnz] = timer_nr_;
++_roomTimer.TimerAnz;
2019-11-04 21:24:37 +00:00
}
2021-10-26 02:16:34 +00:00
return timer_nr_;
2019-11-04 21:24:37 +00:00
}
void Room::set_timer_status(int16 ani_nr, int16 status) {
2022-02-11 04:56:57 +00:00
for (int i = 0; i < _roomTimer.TimerAnz; i++) {
if (_roomTimer.ObjNr[i] == ani_nr) {
2022-02-27 22:22:24 +00:00
_G(uhr)->setStatus(_roomTimer.TimerNr[i], status);
2019-11-04 21:24:37 +00:00
}
}
}
void Room::set_zoom(int16 zoom) {
_roomInfo->_zoomFactor = (uint8)zoom;
2019-11-04 21:24:37 +00:00
}
void Room::set_pal(const byte *src_pal, byte *dest_pal) {
2019-11-04 21:24:37 +00:00
memcpy(dest_pal, src_pal, 768l);
dest_pal[767] = 63;
dest_pal[766] = 63;
dest_pal[765] = 63;
dest_pal[0] = 0;
dest_pal[1] = 0;
dest_pal[2] = 0;
2019-11-04 21:24:37 +00:00
}
void Room::set_ak_pal(RaumBlk *Rb) {
2022-02-11 04:56:57 +00:00
set_pal(_ablagePal[Rb->AkAblage], Rb->LowPalMem);
2019-11-04 21:24:37 +00:00
}
void Room::calc_invent(RaumBlk *Rb, Spieler *player) {
byte *tmp_inv_spr[MAX_MOV_OBJ];
2019-11-04 21:24:37 +00:00
_G(obj)->sort();
memcpy(tmp_inv_spr, Rb->InvSprAdr, MAX_MOV_OBJ * sizeof(char *));
memset(Rb->InvSprAdr, 0, MAX_MOV_OBJ * sizeof(char *));
2019-11-04 21:24:37 +00:00
SpriteResource *spriteRes = new SpriteResource(Rb->InvFile);
for (int16 i = 1; i < _G(obj)->mov_obj_room[0] + 1; i++) {
if (!tmp_inv_spr[_G(obj)->mov_obj_room[i]]) {
spriteRes->getSpriteData(_G(obj)->mov_obj_room[i], &Rb->InvSprAdr[_G(obj)->mov_obj_room[i]], true);
} else {
Rb->InvSprAdr[_G(obj)->mov_obj_room[i]] = tmp_inv_spr[_G(obj)->mov_obj_room[i]];
tmp_inv_spr[_G(obj)->mov_obj_room[i]] = nullptr;
2019-11-04 21:24:37 +00:00
}
}
2019-11-04 21:24:37 +00:00
for (int16 i = 1; i < _G(obj)->spieler_invnr[0] + 1; i++) {
if (!tmp_inv_spr[_G(obj)->spieler_invnr[i]]) {
spriteRes->getSpriteData(_G(obj)->spieler_invnr[i], &Rb->InvSprAdr[_G(obj)->spieler_invnr[i]], true);
} else {
Rb->InvSprAdr[_G(obj)->spieler_invnr[i]] = tmp_inv_spr[_G(obj)->spieler_invnr[i]];
tmp_inv_spr[_G(obj)->spieler_invnr[i]] = 0;
2019-11-04 21:24:37 +00:00
}
}
2019-11-04 21:24:37 +00:00
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] == nullptr) {
spriteRes->getSpriteData(player->AkInvent, &Rb->InvSprAdr[player->AkInvent], true);
2019-11-04 21:24:37 +00:00
}
}
delete spriteRes;
2019-11-04 21:24:37 +00:00
}
int16 Room::load_tgp(int16 nr, RaumBlk *Rb, int16 tgp_idx, int16 mode, const char *fileName) {
BackgroundResource *res = new BackgroundResource(fileName);
TBFChunk *img = res->getImage(nr, false);
Rb->AkAblage = get_ablage(nr + (1000 * tgp_idx), img->size + 4);
2019-11-04 21:24:37 +00:00
if (Rb->AkAblage == -1) {
} else if (Rb->AkAblage >= 1000) {
Rb->AkAblage -= 1000;
2019-11-04 21:24:37 +00:00
} else {
// Image width and height is piggy-banked inside the image data
2022-02-11 04:56:57 +00:00
uint16 *memPtr = (uint16 *)_ablage[Rb->AkAblage];
memPtr[0] = img->width;
memPtr[1] = img->height;
2022-02-11 04:56:57 +00:00
memcpy(_ablage[Rb->AkAblage] + 4, img->data, img->size);
memcpy(_ablagePal[Rb->AkAblage], img->palette, 3 * 256);
set_ablage_info(Rb->AkAblage, nr + (1000 * tgp_idx), img->size);
if (mode == GED_LOAD) {
Common::SeekableReadStream *gstream = dynamic_cast<Common::SeekableReadStream *>(
2022-02-28 21:45:53 +00:00
_roomHandle[R_GEP_DATA]);
_G(ged)->load_ged_pool(gstream, &_gedInfo[Rb->AkAblage],
2022-02-11 04:56:57 +00:00
nr, _gedMem[Rb->AkAblage]);
_gedXAnz[Rb->AkAblage] = img->width / _gedInfo[Rb->AkAblage].X;
_gedYAnz[Rb->AkAblage] = img->height / _gedInfo[Rb->AkAblage].Y;
}
2019-11-04 21:24:37 +00:00
}
2021-09-16 04:18:05 +00:00
delete img;
delete res;
return true;
2019-11-04 21:24:37 +00:00
}
void Room::init_ablage() {
2022-02-11 04:56:57 +00:00
_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);
_akAblage = 0;
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;
_ablagePal[i] = _ablagePal[0] + 768l * i;
_gedMem[i] = _gedMem[0] + (GED_BLOCK_SIZE * i);
2019-11-04 21:24:37 +00:00
}
}
void Room::free_ablage() {
2022-02-11 04:56:57 +00:00
free(_gedMem[0]);
free(_ablagePal[0]);
free(_ablage[0]);
_akAblage = -1;
2019-11-04 21:24:37 +00:00
}
byte *Room::get_ablage(int16 nr) {
2021-12-10 03:58:37 +00:00
byte *ret = nullptr;
2022-02-11 04:56:57 +00:00
if (nr < MAX_ABLAGE && _akAblage != -1) {
ret = _ablage[nr];
2019-11-04 21:24:37 +00:00
}
2021-10-26 03:29:21 +00:00
return ret;
2019-11-04 21:24:37 +00:00
}
byte **Room::get_ablage() {
2021-12-10 03:58:37 +00:00
byte **ret = nullptr;
2022-02-11 04:56:57 +00:00
if (_akAblage != -1) {
ret = &_ablage[0];
2019-11-04 21:24:37 +00:00
}
2021-10-26 03:29:21 +00:00
return ret;
2019-11-04 21:24:37 +00:00
}
byte **Room::get_ged_mem() {
2021-12-10 03:58:37 +00:00
byte **ret = nullptr;
2022-02-11 04:56:57 +00:00
if (_akAblage != -1) {
ret = &_gedMem[0];
2019-11-04 21:24:37 +00:00
}
2021-10-26 03:29:21 +00:00
return ret;
2019-11-04 21:24:37 +00:00
}
int16 Room::get_ablage(int16 pic_nr, uint32 pic_size) {
int16 ret = -1;
uint32 ablage_bedarf = pic_size / ABLAGE_BLOCK_SIZE;
2019-11-04 21:24:37 +00:00
if (pic_size % ABLAGE_BLOCK_SIZE > 4)
++ablage_bedarf;
int16 ende = 0;
2019-11-04 21:24:37 +00:00
for (int16 i = 0; i < MAX_ABLAGE && !ende; i++) {
2022-02-11 04:56:57 +00:00
if (_ablageInfo[i][0] == pic_nr &&
_ablageInfo[i][1] != 255) {
2019-11-04 21:24:37 +00:00
ende = 1;
ret = 1000 + i;
}
}
if (!ende) {
for (int16 i = 0; i < MAX_ABLAGE && !ende; i++) {
2019-11-04 21:24:37 +00:00
ret = get_ablage_g1((int16)ablage_bedarf, i);
ende = 1;
}
}
if (ret != -1) {
if (ret < 1000) {
ende = 0;
while (!ende) {
2022-02-11 04:56:57 +00:00
if (_ablageInfo[_lastAblageSave][1] == 255) {
--_lastAblageSave;
if (_lastAblageSave < 0) {
_lastAblageSave = 0;
_ablageInfo[0][1] = MAX_ABLAGE;
2019-11-04 21:24:37 +00:00
}
} else
ende = 1;
}
2022-02-11 04:56:57 +00:00
int16 i = _ablageInfo[_lastAblageSave][1];
for (int16 j = _lastAblageSave; j < _lastAblageSave + i; j++) {
_ablageInfo[j][0] = -1;
_ablageInfo[j][1] = -1;
2019-11-04 21:24:37 +00:00
}
}
}
2021-10-26 03:29:21 +00:00
return ret;
2019-11-04 21:24:37 +00:00
}
int16 Room::get_ablage_g1(int16 ablage_bedarf, int16 ak_pos) {
short ret = 0;
int16 ende = 0;
int16 count = 0;
2022-02-11 04:56:57 +00:00
_lastAblageSave = ak_pos;
2019-11-04 21:24:37 +00:00
while (!ende) {
2022-02-11 04:56:57 +00:00
if (_lastAblageSave >= MAX_ABLAGE)
_lastAblageSave = 0;
2019-11-04 21:24:37 +00:00
if (ablage_bedarf == 1) {
ende = 1;
2022-02-11 04:56:57 +00:00
ret = _lastAblageSave;
} else if (ablage_bedarf <= MAX_ABLAGE - _lastAblageSave) {
2019-11-04 21:24:37 +00:00
ende = 1;
2022-02-11 04:56:57 +00:00
ret = _lastAblageSave;
} else
2022-02-11 04:56:57 +00:00
++_lastAblageSave;
2019-11-04 21:24:37 +00:00
++count;
if (count > MAX_ABLAGE) {
ret = -1;
ende = 1;
}
}
2021-10-26 03:29:21 +00:00
return ret;
2019-11-04 21:24:37 +00:00
}
void Room::set_ablage_info(int16 ablagenr, int16 bildnr, uint32 pic_size) {
uint32 ablage_bedarf = (pic_size / ABLAGE_BLOCK_SIZE);
2019-11-04 21:24:37 +00:00
if (pic_size % ABLAGE_BLOCK_SIZE > 4)
++ablage_bedarf;
int16 j = (int16)ablage_bedarf;
for (int16 i = ablagenr; i < j + ablagenr; i++) {
2022-02-11 04:56:57 +00:00
_ablageInfo[i][0] = bildnr;
_ablageInfo[i][1] = (int16)ablage_bedarf;
2019-11-04 21:24:37 +00:00
ablage_bedarf = 255;
2022-02-11 04:56:57 +00:00
++_lastAblageSave;
2019-11-04 21:24:37 +00:00
}
}
2022-01-07 06:37:03 +00:00
void load_chewy_taf(int16 taf_nr) {
2022-02-14 01:32:26 +00:00
if (_G(AkChewyTaf) != taf_nr) {
if (_G(chewy)) {
free((char *)_G(chewy));
_G(chewy) = nullptr;
2022-01-07 06:37:03 +00:00
}
_G(spieler_mi)[P_CHEWY].HotY = CH_HOT_Y;
const char *fname_;
2022-01-07 06:37:03 +00:00
switch (taf_nr) {
case CHEWY_NORMAL:
fname_ = CHEWY_TAF;
_G(chewy_ph_anz) = CHEWY_PHASEN_ANZ;
_G(chewy_ph) = (const uint8 *)CHEWY_PHASEN;
2022-01-07 06:37:03 +00:00
break;
case CHEWY_BORK:
fname_ = CHEWY_BO_TAF;
_G(chewy_ph_anz) = CHEWY_BO_PHASEN_ANZ;
_G(chewy_ph) = (const uint8 *)CHEWY_BO_PHASEN;
2022-01-07 06:37:03 +00:00
break;
case CHEWY_MINI:
fname_ = CHEWY_MI_TAF;
_G(chewy_ph_anz) = CHEWY_MI_PHASEN_ANZ;
_G(chewy_ph) = (const uint8 *)CHEWY_MI_PHASEN;
2022-01-07 06:37:03 +00:00
break;
case CHEWY_PUMPKIN:
fname_ = CHEWY_PUMP_TAF;
_G(chewy_ph_anz) = CHEWY_MI_PHASEN_ANZ;
_G(chewy_ph) = (const uint8 *)CHEWY_MI_PHASEN;
2022-01-07 06:37:03 +00:00
break;
case CHEWY_ROCKER:
fname_ = CHEWY_ROCK_TAF;
_G(chewy_ph_anz) = CHEWY_RO_PHASEN_ANZ;
_G(chewy_ph) = (const uint8 *)CHEWY_RO_PHASEN;
2022-01-07 06:37:03 +00:00
break;
case CHEWY_JMANS:
fname_ = CHEWY_JMAN_TAF;
_G(chewy_ph_anz) = CHEWY_RO_PHASEN_ANZ;
_G(chewy_ph) = (const uint8 *)CHEWY_JM_PHASEN;
_G(spieler_mi)[P_CHEWY].HotY = 68;
2022-01-07 06:37:03 +00:00
break;
case CHEWY_ANI7:
fname_ = CHEWY_HELM_TAF;
_G(chewy_ph_anz) = CHEWY_MI_PHASEN_ANZ;
_G(chewy_ph) = (const uint8 *)CHEWY_MI_PHASEN;
break;
2022-01-07 06:37:03 +00:00
default:
fname_ = NULL;
break;
}
if (fname_ != NULL) {
_G(spieler).ChewyAni = taf_nr;
2022-02-14 01:32:26 +00:00
_G(AkChewyTaf) = taf_nr;
_G(chewy) = _G(mem)->taf_adr(fname_);
2022-02-27 19:00:54 +00:00
_G(chewy_kor) = _G(chewy)->_correction;
2022-01-07 06:37:03 +00:00
}
}
}
2022-03-02 22:42:15 +00:00
void switchRoom(int16 nr) {
_G(fx_blend) = BLEND1;
2022-01-07 06:37:03 +00:00
exit_room(-1);
2022-03-02 22:42:15 +00:00
_G(spieler)._personRoomNr[P_CHEWY] = nr;
_G(room)->loadRoom(&_G(room_blk), _G(spieler)._personRoomNr[P_CHEWY], &_G(spieler));
2022-01-30 05:28:03 +00:00
enter_room(-1);
2022-03-01 22:49:01 +00:00
setupScreen(DO_SETUP);
2022-01-07 06:37:03 +00:00
}
void calc_person_look() {
for (int16 i = 1; i < MAX_PERSON; i++) {
if (_G(spieler_mi)[i].Id != NO_MOV_OBJ) {
2022-01-07 06:37:03 +00:00
if (_G(spieler_vector)[i].Xypos[0] > _G(spieler_vector)[P_CHEWY].Xypos[0])
_G(person_end_phase)[i] = P_LEFT;
2022-01-07 06:37:03 +00:00
else
_G(person_end_phase)[i] = P_RIGHT;
2022-01-07 06:37:03 +00:00
}
}
}
2021-09-12 22:41:09 +00:00
} // namespace Chewy