2019-11-04 22:24:37 +01: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 15:54:17 -08: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 22:24:37 +01: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 15:54:17 -08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2019-11-04 22:24:37 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-09-11 20:13:53 -07:00
|
|
|
#include "chewy/defines.h"
|
2022-02-13 18:43:31 -08:00
|
|
|
#include "chewy/globals.h"
|
2022-02-01 21:25:13 +02:00
|
|
|
#include "chewy/sound.h"
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2021-09-12 15:41:09 -07:00
|
|
|
namespace Chewy {
|
|
|
|
|
2019-11-04 22:24:37 +01:00
|
|
|
#define ZOBJ_ANI_DETAIL 1
|
|
|
|
#define ZOBJ_STATIC_DETAIL 2
|
|
|
|
#define ZOBJ_INVENTAR 3
|
|
|
|
#define ZOBJ_AUTO_OBJ 4
|
|
|
|
#define ZOBJ_PROGANI 5
|
|
|
|
#define ZOBJ_CHEWY 6
|
|
|
|
#define ZOBJ_HOWARD 7
|
|
|
|
#define ZOBJ_NICHELLE 8
|
|
|
|
|
2022-02-13 10:26:03 -08:00
|
|
|
static const int16 SPZ_ANI_PH[][2] = {
|
|
|
|
{ 0, 12 },
|
|
|
|
{ 12, 6 },
|
|
|
|
{ 18, 6 },
|
|
|
|
{ 24, 6 },
|
|
|
|
{ 30, 6 },
|
|
|
|
{ 36, 6 },
|
|
|
|
{ 42, 6 },
|
|
|
|
{ 48, 5 },
|
|
|
|
{ 53, 3 },
|
|
|
|
{ 56, 14 },
|
|
|
|
{ 70, 7 },
|
|
|
|
{ 77, 6 },
|
|
|
|
{ 83, 5 },
|
|
|
|
{ 88, 8 },
|
|
|
|
{ 96, 5 },
|
|
|
|
{ 5, 7 },
|
|
|
|
{ 24, 12 },
|
|
|
|
{ 101, 19 },
|
|
|
|
{ 120, 8 },
|
|
|
|
{ 128, 3 },
|
|
|
|
{ 128, 8 },
|
|
|
|
{ 136, 8 },
|
|
|
|
{ 465, 8 },
|
|
|
|
{ 473, 3 },
|
|
|
|
{ 473, 8 },
|
|
|
|
{ 481, 8 },
|
|
|
|
{ 144, 6 },
|
|
|
|
{ 150, 5 },
|
|
|
|
{ 155, 9 },
|
|
|
|
{ 155, 3 },
|
|
|
|
{ 164, 3 },
|
|
|
|
{ 167, 8 },
|
|
|
|
{ 175, 7 },
|
|
|
|
{ 182, 10 },
|
|
|
|
{ 192, 15 },
|
|
|
|
{ 214, 8 },
|
|
|
|
{ 207, 3 },
|
|
|
|
{ 210, 4 },
|
|
|
|
{ 214, 8 },
|
|
|
|
{ 559, 8 },
|
|
|
|
{ 552, 3 },
|
|
|
|
{ 555, 4 },
|
|
|
|
{ 559, 8 },
|
|
|
|
{ 222, 7 },
|
|
|
|
{ 229, 4 },
|
|
|
|
{ 233, 9 },
|
|
|
|
{ 242, 4 },
|
|
|
|
{ 270, 8 },
|
|
|
|
{ 246, 8 },
|
|
|
|
{ 297, 3 },
|
|
|
|
{ 297, 8 },
|
|
|
|
{ 262, 8 },
|
|
|
|
{ 591, 8 },
|
|
|
|
{ 642, 3 },
|
|
|
|
{ 642, 8 },
|
|
|
|
{ 254, 8 },
|
|
|
|
{ 288, 3 },
|
|
|
|
{ 288, 9 },
|
|
|
|
{ 607, 8 },
|
|
|
|
{ 599, 8 },
|
|
|
|
{ 633, 3 },
|
|
|
|
{ 633, 9 },
|
|
|
|
{ 305, 18 },
|
|
|
|
{ 278, 10 },
|
|
|
|
{ 323, 2 },
|
|
|
|
{ 325, 6 },
|
|
|
|
{ 331, 2 },
|
|
|
|
{ 333, 8 },
|
|
|
|
{ 341, 4 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-11-04 22:24:37 +01:00
|
|
|
void sprite_engine() {
|
|
|
|
int16 min_zeiger = 0;
|
|
|
|
int16 spr_nr;
|
|
|
|
int16 x, y;
|
|
|
|
ObjMov detmov;
|
2022-02-13 18:58:04 -08:00
|
|
|
TafSeqInfo *ts_info;
|
2019-11-04 22:24:37 +01:00
|
|
|
calc_z_ebene();
|
|
|
|
calc_person_ani();
|
2021-10-27 22:17:12 -07:00
|
|
|
|
2022-02-20 23:25:38 +01:00
|
|
|
for (int16 i = 0; i < _G(z_count); i++) {
|
|
|
|
int16 zmin = 3000;
|
|
|
|
for (int16 j = 0; j < _G(z_count); j++) {
|
2022-02-10 21:52:20 -08:00
|
|
|
if (_G(z_obj_sort)[j].ObjZ != 3000 && _G(z_obj_sort)[j].ObjZ < zmin) {
|
|
|
|
zmin = _G(z_obj_sort)[j].ObjZ;
|
2019-11-04 22:24:37 +01:00
|
|
|
min_zeiger = j;
|
|
|
|
}
|
|
|
|
}
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 nr = (int16)_G(z_obj_sort)[min_zeiger].ObjNr;
|
2021-10-27 22:17:12 -07:00
|
|
|
|
2022-02-10 21:52:20 -08:00
|
|
|
switch (_G(z_obj_sort)[min_zeiger].ObjArt) {
|
2019-11-04 22:24:37 +01:00
|
|
|
case ZOBJ_ANI_DETAIL:
|
2022-02-13 17:46:17 -08:00
|
|
|
if (_G(Adi)[nr].zoom) {
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-13 17:46:17 -08:00
|
|
|
y = _G(Adi)[nr].y;
|
|
|
|
calc_zoom(y, (int16)_G(room)->_roomInfo->ZoomFak, (int16)_G(room)->_roomInfo->ZoomFak, &detmov);
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
|
|
|
detmov.Xzoom = 0;
|
|
|
|
detmov.Yzoom = 0;
|
|
|
|
}
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(det)->plot_ani_details(_G(spieler).scrollx, _G(spieler).scrolly, nr, nr,
|
2019-11-04 22:24:37 +01:00
|
|
|
detmov.Xzoom, detmov.Yzoom);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ZOBJ_STATIC_DETAIL:
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(det)->plot_static_details(_G(spieler).scrollx, _G(spieler).scrolly, nr, nr);
|
2019-11-04 22:24:37 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ZOBJ_INVENTAR:
|
2022-02-13 16:48:12 -08:00
|
|
|
_G(out)->sprite_set(_G(inv_spr)[nr],
|
2021-11-14 16:35:08 -08:00
|
|
|
_G(spieler).room_m_obj[nr].X - _G(spieler).scrollx,
|
|
|
|
_G(spieler).room_m_obj[nr].Y - _G(spieler).scrolly, 0);
|
2019-11-04 22:24:37 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ZOBJ_CHEWY:
|
2021-11-14 16:35:08 -08:00
|
|
|
if (!_G(spieler).PersonHide[P_CHEWY]) {
|
2022-02-13 17:32:26 -08:00
|
|
|
if (!_G(spz_ani)[P_CHEWY]) {
|
2022-02-13 18:25:29 -08:00
|
|
|
spr_nr = _G(chewy_ph)[_G(spieler_vector)[P_CHEWY].Phase * 8 + _G(spieler_vector)[P_CHEWY].PhNr];
|
|
|
|
x = _G(spieler_mi)[P_CHEWY].XyzStart[0] + _G(chewy_kor)[spr_nr * 2] - _G(spieler).scrollx;
|
|
|
|
y = _G(spieler_mi)[P_CHEWY].XyzStart[1] + _G(chewy_kor)[spr_nr * 2 + 1] - _G(spieler).scrolly;
|
|
|
|
calc_zoom(_G(spieler_mi)[P_CHEWY].XyzStart[1], (int16)_G(room)->_roomInfo->ZoomFak,
|
|
|
|
(int16)_G(room)->_roomInfo->ZoomFak, &_G(spieler_vector)[P_CHEWY]);
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(out)->scale_set(_G(chewy)->image[spr_nr], x, y,
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[P_CHEWY].Xzoom,
|
|
|
|
_G(spieler_vector)[P_CHEWY].Yzoom,
|
2022-02-13 12:22:53 -08:00
|
|
|
_G(scr_width));
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
2022-02-13 18:25:29 -08:00
|
|
|
spr_nr = _G(spz_spr_nr)[_G(spieler_vector)[P_CHEWY].PhNr];
|
|
|
|
x = _G(spieler_mi)[P_CHEWY].XyzStart[0] + _G(spz_tinfo)->korrektur[spr_nr * 2] -
|
2021-11-14 16:35:08 -08:00
|
|
|
_G(spieler).scrollx;
|
2022-02-13 18:25:29 -08:00
|
|
|
y = _G(spieler_mi)[P_CHEWY].XyzStart[1] + _G(spz_tinfo)->korrektur[spr_nr * 2 + 1] -
|
2021-11-14 16:35:08 -08:00
|
|
|
_G(spieler).scrolly;
|
2022-02-13 18:25:29 -08:00
|
|
|
calc_zoom(_G(spieler_mi)[P_CHEWY].XyzStart[1],
|
2022-02-13 17:46:17 -08:00
|
|
|
(int16)_G(room)->_roomInfo->ZoomFak,
|
|
|
|
(int16)_G(room)->_roomInfo->ZoomFak,
|
2022-02-13 18:25:29 -08:00
|
|
|
&_G(spieler_vector)[P_CHEWY]);
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(out)->scale_set(_G(spz_tinfo)->image[spr_nr], x, y,
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[P_CHEWY].Xzoom,
|
|
|
|
_G(spieler_vector)[P_CHEWY].Yzoom,
|
2022-02-13 12:22:53 -08:00
|
|
|
_G(scr_width));
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ZOBJ_HOWARD:
|
2022-02-20 23:25:38 +01:00
|
|
|
case ZOBJ_NICHELLE: {
|
|
|
|
int16 p_nr = _G(z_obj_sort)[min_zeiger].ObjArt - 6;
|
2021-11-14 16:35:08 -08:00
|
|
|
if (!_G(spieler).PersonHide[p_nr]) {
|
2022-02-13 17:32:26 -08:00
|
|
|
if (!_G(spz_ani)[p_nr]) {
|
|
|
|
ts_info = _G(PersonTaf)[p_nr];
|
2022-02-13 18:25:29 -08:00
|
|
|
spr_nr = _G(PersonSpr)[p_nr][_G(spieler_vector)[p_nr].PhNr];
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
2022-02-13 17:32:26 -08:00
|
|
|
ts_info = _G(spz_tinfo);
|
2022-02-13 18:25:29 -08:00
|
|
|
spr_nr = _G(spz_spr_nr)[_G(spieler_vector)[p_nr].PhNr];
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
2022-02-20 23:25:38 +01:00
|
|
|
x = _G(spieler_mi)[p_nr].XyzStart[0] + ts_info->korrektur[spr_nr * 2] - _G(spieler).scrollx;
|
|
|
|
y = _G(spieler_mi)[p_nr].XyzStart[1] + ts_info->korrektur[spr_nr * 2 + 1] - _G(spieler).scrolly;
|
|
|
|
calc_zoom(_G(spieler_mi)[p_nr].XyzStart[1], _G(spieler).ZoomXy[p_nr][0],_G(spieler).ZoomXy[p_nr][1], &_G(spieler_vector)[p_nr]);
|
|
|
|
_G(out)->scale_set(ts_info->image[spr_nr], x, y, _G(spieler_vector)[p_nr].Xzoom, _G(spieler_vector)[p_nr].Yzoom, _G(scr_width));
|
|
|
|
}
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ZOBJ_PROGANI:
|
2022-02-20 23:25:38 +01:00
|
|
|
_G(out)->sprite_set(_G(spr_info)[nr].Image, _G(spr_info)[nr].X - _G(spieler).scrollx, _G(spr_info)[nr].Y - _G(spieler).scrolly, 0);
|
2019-11-04 22:24:37 +01:00
|
|
|
break;
|
|
|
|
|
2022-02-20 23:25:38 +01:00
|
|
|
case ZOBJ_AUTO_OBJ: {
|
2022-02-13 18:25:29 -08:00
|
|
|
spr_nr = _G(mov_phasen)[nr].Phase[_G(auto_mov_vector)[nr].Phase][0] +
|
|
|
|
_G(auto_mov_vector)[nr].PhNr;
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 *cxy = _G(room_blk).DetKorrekt + (spr_nr << 1);
|
2022-02-13 18:25:29 -08:00
|
|
|
calc_zoom(_G(auto_mov_vector)[nr].Xypos[1],
|
|
|
|
_G(mov_phasen)[nr].ZoomFak,
|
|
|
|
_G(mov_phasen)[nr].ZoomFak,
|
|
|
|
&_G(auto_mov_vector)[nr]);
|
2022-02-13 18:37:34 -08:00
|
|
|
_G(out)->scale_set(_G(room_blk).DetImage[spr_nr],
|
2022-02-20 23:25:38 +01:00
|
|
|
_G(auto_mov_vector)[nr].Xypos[0] + cxy[0] - _G(spieler).scrollx,
|
|
|
|
_G(auto_mov_vector)[nr].Xypos[1] + cxy[1] - _G(spieler).scrolly,
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(auto_mov_vector)[nr].Xzoom,
|
|
|
|
_G(auto_mov_vector)[nr].Yzoom, _G(scr_width));
|
2022-02-20 23:25:38 +01:00
|
|
|
}
|
2019-11-04 22:24:37 +01:00
|
|
|
break;
|
|
|
|
|
2021-10-27 20:20:58 -07:00
|
|
|
default:
|
|
|
|
break;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(z_obj_sort)[min_zeiger].ObjZ = 3000;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void calc_z_ebene() {
|
|
|
|
int16 i;
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(z_count) = 0;
|
2019-11-04 22:24:37 +01:00
|
|
|
|
|
|
|
for (i = 0; i < MAX_PERSON; i++) {
|
2021-11-14 16:35:08 -08:00
|
|
|
if (_G(spieler).PersonRoomNr[P_CHEWY + i] == _G(spieler).PersonRoomNr[P_CHEWY] &&
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_mi)[P_CHEWY + i].Id != NO_MOV_OBJ) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjArt = ZOBJ_CHEWY + i;
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjZ = _G(spieler_vector)[P_CHEWY + i].Xypos[1] +
|
|
|
|
_G(spieler_mi)[P_CHEWY + i].HotMovY
|
|
|
|
- abs(_G(spieler_vector)[P_CHEWY + i].Yzoom);
|
2022-02-10 21:52:20 -08:00
|
|
|
++_G(z_count);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < MAXDETAILS; i++) {
|
2022-02-13 17:46:17 -08:00
|
|
|
if (_G(Sdi)[i].SprNr != -1) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjArt = ZOBJ_STATIC_DETAIL;
|
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjNr = i;
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjZ = _G(Sdi)[i].z_ebene;
|
2022-02-10 21:52:20 -08:00
|
|
|
++_G(z_count);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
2022-02-13 17:46:17 -08:00
|
|
|
if (_G(Adi)[i].start_ani != -1) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjArt = ZOBJ_ANI_DETAIL;
|
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjNr = i;
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjZ = _G(Adi)[i].z_ebene;
|
2022-02-10 21:52:20 -08:00
|
|
|
++_G(z_count);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-13 17:46:17 -08:00
|
|
|
for (i = 0; i < _G(obj)->mov_obj_room[0]; i++) {
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-13 17:46:17 -08:00
|
|
|
if (_G(spieler).room_m_obj[_G(obj)->mov_obj_room[i + 1]].ZEbene < 2000) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjArt = ZOBJ_INVENTAR;
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjNr = _G(obj)->mov_obj_room[i + 1];
|
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjZ = _G(spieler).room_m_obj[_G(obj)->mov_obj_room[i + 1]].ZEbene;
|
2022-02-10 21:52:20 -08:00
|
|
|
++_G(z_count);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_PROG_ANI; i++) {
|
2022-02-13 18:25:29 -08:00
|
|
|
if (_G(spr_info)[i].ZEbene < 200) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjArt = ZOBJ_PROGANI;
|
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjNr = i;
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjZ = _G(spr_info)[i].ZEbene;
|
2022-02-10 21:52:20 -08:00
|
|
|
++_G(z_count);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-14 16:02:05 -08:00
|
|
|
for (i = 0; i < _G(auto_obj); i++) {
|
2022-02-13 18:25:29 -08:00
|
|
|
if (_G(auto_mov_vector)[i].Xypos[2] < 200) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjArt = ZOBJ_AUTO_OBJ;
|
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjNr = i;
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(z_obj_sort)[_G(z_count)].ObjZ = _G(auto_mov_vector)[i].Xypos[2];
|
2022-02-10 21:52:20 -08:00
|
|
|
++_G(z_count);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int16 mouse_on_prog_ani() {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 ani_nr = -1;
|
|
|
|
for (int16 i = 0; i < MAX_PROG_ANI && ani_nr == -1; i++) {
|
2022-02-13 18:37:34 -08:00
|
|
|
if (_G(minfo).x >= _G(spr_info)[i].X && _G(minfo).x <= _G(spr_info)[i].X1 &&
|
|
|
|
_G(minfo).y >= _G(spr_info)[i].Y && _G(minfo).y <= _G(spr_info)[i].Y1) {
|
2019-11-04 22:24:37 +01:00
|
|
|
ani_nr = i;
|
|
|
|
}
|
|
|
|
}
|
2021-10-25 20:29:21 -07:00
|
|
|
|
|
|
|
return ani_nr;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void set_person_pos(int16 x, int16 y, int16 p_nr, int16 richtung) {
|
|
|
|
if (richtung != -1)
|
|
|
|
set_person_spr(richtung, p_nr);
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[p_nr].Xypos[0] = x;
|
|
|
|
_G(spieler_vector)[p_nr].Xypos[1] = y;
|
|
|
|
_G(spieler_mi)[p_nr].XyzStart[0] = x;
|
|
|
|
_G(spieler_mi)[p_nr].XyzStart[1] = y;
|
|
|
|
_G(spieler_vector)[p_nr].Count = 0;
|
|
|
|
_G(spieler_vector)[p_nr].Delay = _G(spieler).DelaySpeed;
|
|
|
|
_G(spieler_vector)[p_nr].DelayCount = 0;
|
|
|
|
calc_zoom(_G(spieler_mi)[p_nr].XyzStart[1],
|
2021-11-14 16:35:08 -08:00
|
|
|
_G(spieler).ZoomXy[p_nr][0],
|
|
|
|
_G(spieler).ZoomXy[p_nr][1],
|
2022-02-13 18:25:29 -08:00
|
|
|
&_G(spieler_vector)[p_nr]);
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 tmp_nr = p_nr;
|
2019-11-04 22:24:37 +01:00
|
|
|
if (p_nr >= P_NICHELLE) {
|
|
|
|
++tmp_nr;
|
|
|
|
}
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(ssi)[tmp_nr].X = _G(spieler_vector)[p_nr].Xypos[0] - _G(spieler).scrollx + _G(spieler_mi)[p_nr].HotX;
|
|
|
|
_G(ssi)[tmp_nr].Y = _G(spieler_vector)[p_nr].Xypos[1] - _G(spieler).scrolly;
|
2022-02-13 18:37:34 -08:00
|
|
|
if (!_G(flags).ExitMov) {
|
2019-11-04 22:24:37 +01:00
|
|
|
if (p_nr == P_CHEWY) {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 u_index = _G(ged)->ged_idx(x + _G(spieler_mi)[p_nr].HotX, y + _G(spieler_mi)[p_nr].HotY,
|
|
|
|
_G(room)->_gedXAnz[_G(room_blk).AkAblage],
|
|
|
|
_G(ged_mem)[_G(room_blk).AkAblage]);
|
2019-11-04 22:24:37 +01:00
|
|
|
check_shad(u_index, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_person_spr(int16 nr, int16 p_nr) {
|
|
|
|
if (nr == 5 || nr == 4)
|
|
|
|
nr = 0;
|
|
|
|
else if (nr == 10 || nr == 7)
|
|
|
|
nr = 1;
|
|
|
|
|
|
|
|
switch (p_nr) {
|
|
|
|
case P_CHEWY:
|
|
|
|
switch (nr) {
|
|
|
|
case P_LEFT:
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[P_CHEWY].Phase = CH_L_STEHEN;
|
|
|
|
_G(spieler_vector)[P_CHEWY].PhNr = 0;
|
|
|
|
_G(spieler_vector)[P_CHEWY].PhAnz = _G(chewy_ph_anz)[CH_L_STEHEN];
|
|
|
|
_G(person_end_phase)[P_CHEWY] = P_LEFT;
|
2019-11-04 22:24:37 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case P_RIGHT:
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[P_CHEWY].Phase = CH_R_STEHEN;
|
|
|
|
_G(spieler_vector)[P_CHEWY].PhNr = 0;
|
|
|
|
_G(spieler_vector)[P_CHEWY].PhAnz = _G(chewy_ph_anz)[CH_R_STEHEN];
|
|
|
|
_G(person_end_phase)[P_CHEWY] = P_RIGHT;
|
2019-11-04 22:24:37 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case P_HOWARD:
|
|
|
|
case P_NICHELLE:
|
|
|
|
#define HO_L_STEHEN 0
|
|
|
|
#define HO_R_STEHEN 0
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[p_nr].PhNr = 0;
|
|
|
|
_G(spieler_vector)[p_nr].PhAnz = 8;
|
|
|
|
_G(person_end_phase)[p_nr] = P_LEFT;
|
2019-11-04 22:24:37 +01:00
|
|
|
switch (nr) {
|
|
|
|
case P_LEFT:
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[p_nr].Phase = HO_L_STEHEN;
|
|
|
|
_G(spieler_vector)[p_nr].PhNr = 0;
|
|
|
|
_G(spieler_vector)[p_nr].PhAnz = 8;
|
|
|
|
_G(person_end_phase)[p_nr] = P_LEFT;
|
2019-11-04 22:24:37 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case P_RIGHT:
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[p_nr].Phase = HO_R_STEHEN;
|
|
|
|
_G(spieler_vector)[p_nr].PhNr = 0;
|
|
|
|
_G(spieler_vector)[p_nr].PhAnz = 8;
|
|
|
|
_G(person_end_phase)[p_nr] = P_RIGHT;
|
2019-11-04 22:24:37 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2021-10-27 20:20:58 -07:00
|
|
|
default:
|
|
|
|
break;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void stop_person(int16 p_nr) {
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(mov)->stop_auto_go();
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[p_nr].Count = 0;
|
2019-11-04 22:24:37 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void start_detail_wait(int16 ani_nr, int16 rep, int16 mode) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(tmp_maus_links) = _G(maus_links_click);
|
2021-11-14 16:02:05 -08:00
|
|
|
_G(maus_links_click) = false;
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(det)->start_detail(ani_nr, rep, mode);
|
|
|
|
while (_G(det)->get_ani_status(ani_nr) && !SHOULD_QUIT) {
|
2019-11-04 22:24:37 +01:00
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(maus_links_click) = _G(tmp_maus_links);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void start_detail_frame(int16 ani_nr, int16 rep, int16 mode, int16 frame) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(tmp_maus_links) = _G(maus_links_click);
|
2021-11-14 16:02:05 -08:00
|
|
|
_G(maus_links_click) = false;
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(det)->start_detail(ani_nr, rep, mode);
|
2022-02-20 23:25:38 +01:00
|
|
|
AniDetailInfo *adi = _G(det)->get_ani_detail(ani_nr);
|
2019-11-04 22:24:37 +01:00
|
|
|
if (mode == ANI_VOR)
|
|
|
|
frame = adi->ani_count + frame;
|
|
|
|
else
|
|
|
|
frame = adi->ani_count - frame;
|
2022-02-13 17:46:17 -08:00
|
|
|
while (_G(det)->get_ani_status(ani_nr) && adi->ani_count != frame && !SHOULD_QUIT) {
|
2019-11-04 22:24:37 +01:00
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(maus_links_click) = _G(tmp_maus_links);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void wait_detail(int16 det_nr) {
|
2022-02-13 17:46:17 -08:00
|
|
|
while (_G(det)->get_ani_status(det_nr) && !SHOULD_QUIT)
|
2019-11-04 22:24:37 +01:00
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wait_show_screen(int16 frames) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(tmp_maus_links) = _G(maus_links_click);
|
2021-11-14 16:02:05 -08:00
|
|
|
_G(maus_links_click) = false;
|
2021-11-14 16:35:08 -08:00
|
|
|
if (_G(spieler).DelaySpeed > 0)
|
|
|
|
frames *= _G(spieler).DelaySpeed;
|
2021-10-26 21:32:59 -07:00
|
|
|
while (--frames > 0 && !SHOULD_QUIT) {
|
2022-02-13 18:37:34 -08:00
|
|
|
if (_G(flags).AniUserAction)
|
2019-11-04 22:24:37 +01:00
|
|
|
get_user_key(NO_SETUP);
|
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(maus_links_click) = _G(tmp_maus_links);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
2022-01-10 23:05:42 -08:00
|
|
|
void start_ani_block(int16 anz, const AniBlock *ab) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(tmp_maus_links) = _G(maus_links_click);
|
2021-11-14 16:02:05 -08:00
|
|
|
_G(maus_links_click) = false;
|
2022-02-20 23:25:38 +01:00
|
|
|
for (int16 i = 0; i < anz; i++) {
|
2019-11-04 22:24:37 +01:00
|
|
|
if (ab[i].Mode == ANI_WAIT)
|
|
|
|
start_detail_wait(ab[i].Nr, ab[i].Repeat, ab[i].Dir);
|
|
|
|
else
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(det)->start_detail(ab[i].Nr, ab[i].Repeat, ab[i].Dir);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(maus_links_click) = _G(tmp_maus_links);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void start_aad_wait(int16 dia_nr, int16 str_nr) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(tmp_maus_links) = _G(maus_links_click);
|
2021-11-14 16:02:05 -08:00
|
|
|
_G(maus_links_click) = false;
|
2022-02-13 17:22:54 -08:00
|
|
|
_G(talk_start_ani) = -1;
|
|
|
|
_G(talk_hide_static) = -1;
|
2019-11-04 22:24:37 +01:00
|
|
|
set_ssi_xy();
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(atds)->start_aad(dia_nr);
|
2022-02-16 22:15:57 -08:00
|
|
|
|
|
|
|
while (!SHOULD_QUIT && (
|
|
|
|
_G(atds)->aad_get_status() != -1 ||
|
|
|
|
g_engine->_sound->isSpeechActive()
|
|
|
|
)) {
|
2019-11-04 22:24:37 +01:00
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
2022-02-16 22:15:57 -08:00
|
|
|
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(maus_links_click) = _G(tmp_maus_links);
|
2022-02-13 18:37:34 -08:00
|
|
|
if (_G(minfo).button)
|
|
|
|
_G(flags).main_maus_flag = 1;
|
|
|
|
_G(kbinfo).scan_code = Common::KEYCODE_INVALID;
|
2019-11-04 22:24:37 +01:00
|
|
|
stop_spz();
|
|
|
|
}
|
|
|
|
|
|
|
|
void start_aad(int16 dia_nr) {
|
2022-02-01 21:25:13 +02:00
|
|
|
g_engine->_sound->waitForSpeechToFinish();
|
2019-11-04 22:24:37 +01:00
|
|
|
set_ssi_xy();
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(atds)->start_aad(dia_nr);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool start_ats_wait(int16 txt_nr, int16 txt_mode, int16 col, int16 mode) {
|
|
|
|
bool ret = false;
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(tmp_maus_links) = _G(maus_links_click);
|
2021-11-14 16:02:05 -08:00
|
|
|
_G(maus_links_click) = false;
|
2022-02-07 19:41:14 -08:00
|
|
|
|
2022-02-13 18:37:34 -08:00
|
|
|
if (!_G(flags).AtsText) {
|
|
|
|
_G(flags).AtsText = true;
|
2019-11-04 22:24:37 +01:00
|
|
|
if (txt_nr != -1) {
|
2022-02-13 16:48:12 -08:00
|
|
|
if (_G(menu_item) != CUR_WALK)
|
2019-11-04 22:24:37 +01:00
|
|
|
atds_string_start(30000, 0, 0, AAD_STR_START);
|
2022-02-17 19:38:08 -08:00
|
|
|
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 VocNr;
|
2022-02-13 17:46:17 -08:00
|
|
|
ret = _G(atds)->start_ats(txt_nr, txt_mode, col, mode, &VocNr);
|
2019-11-04 22:24:37 +01:00
|
|
|
if (ret) {
|
2022-02-13 17:46:17 -08:00
|
|
|
while (_G(atds)->ats_get_status() != false && !SHOULD_QUIT)
|
2019-11-04 22:24:37 +01:00
|
|
|
set_up_screen(DO_SETUP);
|
2022-02-07 19:41:14 -08:00
|
|
|
|
|
|
|
// WORKAROUND: There are a few cases in the game with no text,
|
|
|
|
// but a voice sample the game would fall back on even in
|
|
|
|
// subtitles only mode. Don't allow this in ScummVM
|
2022-02-18 18:53:21 -08:00
|
|
|
} else if (VocNr != -1 && g_engine->_sound->getSpeechSubtitlesMode() != DISPLAY_TXT) {
|
2019-11-04 22:24:37 +01:00
|
|
|
ret = true;
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 vocx = _G(spieler_vector)[P_CHEWY].Xypos[0] - _G(spieler).scrollx + _G(spieler_mi)[P_CHEWY].HotX;
|
2022-02-13 17:46:17 -08:00
|
|
|
g_engine->_sound->setSoundChannelBalance(0, _G(atds)->getStereoPos(vocx));
|
2022-02-01 21:25:13 +02:00
|
|
|
g_engine->_sound->playSpeech(VocNr);
|
|
|
|
//warning("FIXME - unknown constant SMP_PLAYING");
|
2019-11-04 22:24:37 +01:00
|
|
|
|
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
2022-02-17 19:38:08 -08:00
|
|
|
|
2022-02-13 16:48:12 -08:00
|
|
|
if (_G(menu_item) != CUR_WALK)
|
2019-11-04 22:24:37 +01:00
|
|
|
atds_string_start(30000, 0, 0, AAD_STR_END);
|
|
|
|
}
|
2022-02-17 19:38:08 -08:00
|
|
|
|
2022-02-13 18:37:34 -08:00
|
|
|
_G(flags).AtsText = false;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
2022-02-17 19:38:08 -08:00
|
|
|
|
2022-02-13 18:37:34 -08:00
|
|
|
if (_G(minfo).button)
|
|
|
|
_G(flags).main_maus_flag = 1;
|
2022-02-17 19:38:08 -08:00
|
|
|
|
2022-02-13 18:37:34 -08:00
|
|
|
_G(kbinfo).scan_code = Common::KEYCODE_INVALID;
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(maus_links_click) = _G(tmp_maus_links);
|
2022-02-17 19:38:08 -08:00
|
|
|
|
2021-10-25 20:29:21 -07:00
|
|
|
return ret;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void aad_wait(int16 str_nr) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(tmp_maus_links) = _G(maus_links_click);
|
2021-11-14 16:02:05 -08:00
|
|
|
_G(maus_links_click) = false;
|
2019-11-04 22:24:37 +01:00
|
|
|
if (str_nr == -1) {
|
2022-02-13 17:46:17 -08:00
|
|
|
while (_G(atds)->aad_get_status() != -1 && !SHOULD_QUIT) {
|
2019-11-04 22:24:37 +01:00
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
|
|
|
} else {
|
2022-02-13 17:46:17 -08:00
|
|
|
while (_G(atds)->aad_get_status() < str_nr && !SHOULD_QUIT) {
|
2019-11-04 22:24:37 +01:00
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
|
|
|
}
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(maus_links_click) = _G(tmp_maus_links);
|
2022-02-13 18:37:34 -08:00
|
|
|
if (_G(minfo).button)
|
|
|
|
_G(flags).main_maus_flag = 1;
|
|
|
|
_G(kbinfo).scan_code = Common::KEYCODE_INVALID;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void start_aad(int16 dia_nr, int16 ssi_nr) {
|
2022-02-20 23:25:38 +01:00
|
|
|
if (ssi_nr == 0) {
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(ssi)[0].X = _G(spieler_vector)[P_CHEWY].Xypos[0] - _G(spieler).scrollx + _G(spieler_mi)[P_CHEWY].HotX;
|
|
|
|
_G(ssi)[0].Y = _G(spieler_vector)[P_CHEWY].Xypos[1] - _G(spieler).scrolly;
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(atds)->set_split_win(0, &_G(ssi)[0]);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
2022-02-20 23:25:38 +01:00
|
|
|
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(atds)->start_aad(dia_nr);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void start_ads_wait(int16 dia_nr) {
|
2022-02-13 18:37:34 -08:00
|
|
|
if (!_G(flags).AdsDialog) {
|
2022-02-13 16:48:12 -08:00
|
|
|
_G(menu_item) = CUR_TALK;
|
|
|
|
cursor_wahl(_G(menu_item));
|
2019-11-04 22:24:37 +01:00
|
|
|
load_ads_dia(dia_nr);
|
2022-02-13 18:37:34 -08:00
|
|
|
while (_G(flags).AdsDialog && !SHOULD_QUIT) {
|
2019-11-04 22:24:37 +01:00
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void wait_auto_obj(int16 nr) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(tmp_maus_links) = _G(maus_links_click);
|
2021-11-14 16:02:05 -08:00
|
|
|
_G(maus_links_click) = false;
|
2022-02-13 18:25:29 -08:00
|
|
|
while (_G(mov_phasen)[nr].Repeat != -1 && !SHOULD_QUIT) {
|
2019-11-04 22:24:37 +01:00
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(maus_links_click) = _G(tmp_maus_links);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void stop_auto_obj(int16 nr) {
|
2021-11-14 16:02:05 -08:00
|
|
|
if (nr < _G(auto_obj)) {
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(mov_phasen)[nr].Start = false;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void continue_auto_obj(int16 nr, int16 repeat) {
|
2021-11-14 16:02:05 -08:00
|
|
|
if (nr < _G(auto_obj)) {
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(mov_phasen)[nr].Start = 1;
|
2019-11-04 22:24:37 +01:00
|
|
|
if (repeat)
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(mov_phasen)[nr].Repeat = repeat;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-04 22:55:16 -08:00
|
|
|
void init_auto_obj(int16 auto_nr, const int16 *phasen, int16 lines, const MovLine *mline) {
|
2022-02-20 23:25:38 +01:00
|
|
|
const MovLine *tmp2 = mline;
|
|
|
|
int16 *tmp = (int16 *)_G(mov_phasen)[auto_nr].Phase;
|
|
|
|
for (int16 i = 0; i < 8; i++)
|
2019-11-04 22:24:37 +01:00
|
|
|
tmp[i] = phasen[i];
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(mov_phasen)[auto_nr].Start = 1;
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-20 23:25:38 +01:00
|
|
|
MovLine *tmp1 = _G(mov_line)[auto_nr];
|
|
|
|
for (int16 i = 0; i < lines; i++) {
|
2019-11-04 22:24:37 +01:00
|
|
|
tmp1->EndXyz[0] = tmp2->EndXyz[0];
|
|
|
|
tmp1->EndXyz[1] = tmp2->EndXyz[1];
|
|
|
|
tmp1->EndXyz[2] = tmp2->EndXyz[2];
|
|
|
|
tmp1->PhNr = tmp2->PhNr;
|
|
|
|
tmp1->Vorschub = tmp2->Vorschub;
|
|
|
|
++tmp1;
|
|
|
|
++tmp2;
|
|
|
|
}
|
|
|
|
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(auto_mov_obj)[auto_nr].XyzEnd[0] = mline->EndXyz[0];
|
|
|
|
_G(auto_mov_obj)[auto_nr].XyzEnd[1] = mline->EndXyz[1];
|
|
|
|
_G(auto_mov_obj)[auto_nr].XyzEnd[2] = mline->EndXyz[2];
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(auto_mov_vector)[auto_nr].Count = 0;
|
|
|
|
_G(auto_mov_vector)[auto_nr].StNr = 0;
|
|
|
|
_G(auto_mov_vector)[auto_nr].DelayCount = 0;
|
2019-11-04 22:24:37 +01:00
|
|
|
new_auto_line(auto_nr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void new_auto_line(int16 nr) {
|
2021-11-14 16:02:05 -08:00
|
|
|
if (nr < _G(auto_obj)) {
|
2022-02-13 18:25:29 -08:00
|
|
|
if (_G(mov_phasen)[nr].Repeat != -1 &&
|
|
|
|
_G(mov_phasen)[nr].Start) {
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-13 18:25:29 -08:00
|
|
|
if (_G(auto_mov_vector)[nr].StNr < _G(mov_phasen)[nr].Lines) {
|
|
|
|
++_G(auto_mov_vector)[nr].StNr;
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
|
|
|
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(auto_mov_vector)[nr].StNr = 1;
|
|
|
|
if (_G(mov_phasen)[nr].Repeat != 255) {
|
|
|
|
--_G(mov_phasen)[nr].Repeat;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
2022-02-13 18:25:29 -08:00
|
|
|
if (!_G(mov_phasen)[nr].Repeat) {
|
|
|
|
_G(auto_mov_vector)[nr].Xypos[2] = 201;
|
|
|
|
_G(mov_phasen)[nr].Repeat = -1;
|
|
|
|
_G(mov_phasen)[nr].Start = 0;
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(auto_mov_vector)[nr].Phase = _G(mov_line)[nr][_G(auto_mov_vector)[nr].StNr - 1].PhNr;
|
|
|
|
_G(auto_mov_vector)[nr].PhNr = 0;
|
|
|
|
|
|
|
|
_G(auto_mov_vector)[nr].PhAnz = (_G(mov_phasen)[nr].Phase[_G(auto_mov_vector)[nr].Phase][1] -
|
|
|
|
_G(mov_phasen)[nr].Phase[_G(auto_mov_vector)[nr].Phase][0]) + 1;
|
|
|
|
_G(auto_mov_obj)[nr].Vorschub = _G(mov_line)[nr][_G(auto_mov_vector)[nr].StNr - 1].Vorschub;
|
|
|
|
_G(auto_mov_obj)[nr].XyzStart[0] = _G(auto_mov_obj)[nr].XyzEnd[0];
|
|
|
|
_G(auto_mov_obj)[nr].XyzStart[1] = _G(auto_mov_obj)[nr].XyzEnd[1];
|
|
|
|
_G(auto_mov_obj)[nr].XyzStart[2] = _G(auto_mov_obj)[nr].XyzEnd[2];
|
|
|
|
_G(auto_mov_obj)[nr].XyzEnd[0] = _G(mov_line)[nr][_G(auto_mov_vector)[nr].StNr - 1].EndXyz[0] ;
|
|
|
|
_G(auto_mov_obj)[nr].XyzEnd[1] = _G(mov_line)[nr][_G(auto_mov_vector)[nr].StNr - 1].EndXyz[1] ;;
|
|
|
|
_G(auto_mov_obj)[nr].XyzEnd[2] = _G(mov_line)[nr][_G(auto_mov_vector)[nr].StNr - 1].EndXyz[2] ;;
|
|
|
|
_G(mov)->get_mov_vector((int16 *)_G(auto_mov_obj)[nr].XyzStart,
|
|
|
|
_G(auto_mov_obj)[nr].Vorschub, &_G(auto_mov_vector)[nr]);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
} else {
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(auto_mov_vector)[nr].Xypos[2] = 201;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int16 mouse_auto_obj(int16 nr, int16 xoff, int16 yoff) {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 ret = false;
|
2022-02-13 18:25:29 -08:00
|
|
|
if (_G(mov_phasen)[nr].Start == 1) {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 spr_nr = _G(mov_phasen)[nr].Phase[_G(auto_mov_vector)[nr].Phase][0] +
|
|
|
|
_G(auto_mov_vector)[nr].PhNr;
|
|
|
|
int16 *xy = (int16 *)_G(room_blk).DetImage[spr_nr];
|
|
|
|
int16 *Cxy = _G(room_blk).DetKorrekt + (spr_nr << 1);
|
2019-11-04 22:24:37 +01:00
|
|
|
|
|
|
|
if (!xoff) {
|
2022-01-25 19:44:41 -08:00
|
|
|
xoff = xy ? xy[0] : 0;
|
2022-02-13 18:25:29 -08:00
|
|
|
xoff += _G(auto_mov_vector)[nr].Xzoom;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
if (!yoff) {
|
2022-01-25 19:44:41 -08:00
|
|
|
yoff = xy ? xy[1] : 0;
|
2022-02-13 18:25:29 -08:00
|
|
|
yoff += _G(auto_mov_vector)[nr].Yzoom;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
2022-02-13 18:37:34 -08:00
|
|
|
if (_G(minfo).x >= _G(auto_mov_vector)[nr].Xypos[0] + Cxy[0] - _G(spieler).scrollx &&
|
|
|
|
_G(minfo).x <= _G(auto_mov_vector)[nr].Xypos[0] + xoff + Cxy[0] - _G(spieler).scrollx &&
|
|
|
|
_G(minfo).y >= _G(auto_mov_vector)[nr].Xypos[1] + Cxy[1] - _G(spieler).scrolly &&
|
|
|
|
_G(minfo).y <= _G(auto_mov_vector)[nr].Xypos[1] + yoff + Cxy[1] - _G(spieler).scrolly)
|
2019-11-04 22:24:37 +01:00
|
|
|
ret = true;
|
|
|
|
}
|
2021-10-25 20:29:21 -07:00
|
|
|
return ret;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int16 auto_obj_status(int16 nr) {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 status = false;
|
2021-11-14 16:02:05 -08:00
|
|
|
if (nr < _G(auto_obj)) {
|
2022-02-13 18:25:29 -08:00
|
|
|
if (_G(mov_phasen)[nr].Repeat != -1)
|
2019-11-04 22:24:37 +01:00
|
|
|
status = true;
|
|
|
|
}
|
2021-10-25 20:29:21 -07:00
|
|
|
|
|
|
|
return status;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void calc_zoom(int16 y, int16 zoomfak_x, int16 zoomfak_y, ObjMov *om) {
|
2022-02-20 23:25:38 +01:00
|
|
|
float zoom_fak_x = (float)zoomfak_x / (float)100.0;
|
2019-11-04 22:24:37 +01:00
|
|
|
zoom_fak_x = -zoom_fak_x;
|
2022-02-20 23:25:38 +01:00
|
|
|
float zoom_fak_y = (float)zoomfak_y / (float)100.0;
|
2019-11-04 22:24:37 +01:00
|
|
|
zoom_fak_y = -zoom_fak_y;
|
2021-11-14 16:02:05 -08:00
|
|
|
if (!_G(zoom_horizont)) {
|
2019-11-04 22:24:37 +01:00
|
|
|
om->Xzoom = -zoomfak_x;
|
|
|
|
om->Yzoom = -zoomfak_y;
|
|
|
|
} else {
|
2021-11-14 16:02:05 -08:00
|
|
|
if (y < _G(zoom_horizont)) {
|
|
|
|
om->Xzoom = (_G(zoom_horizont) - y) * zoom_fak_x;
|
|
|
|
om->Yzoom = (_G(zoom_horizont) - y) * zoom_fak_y;
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
|
|
|
om->Xzoom = 0;
|
|
|
|
om->Yzoom = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void mov_objekt(ObjMov *om, MovInfo *mi) {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 u_index = 0;
|
2019-11-04 22:24:37 +01:00
|
|
|
|
|
|
|
if (om->DelayCount > 0)
|
|
|
|
--om->DelayCount;
|
|
|
|
else {
|
|
|
|
om->DelayCount = om->Delay;
|
|
|
|
if (om->Count > 0) {
|
|
|
|
|
|
|
|
--om->Count;
|
|
|
|
if (om->PhNr < om->PhAnz - 1)
|
|
|
|
++om->PhNr;
|
|
|
|
else
|
|
|
|
om->PhNr = 0;
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 tmpx = om->Xyvo[0];
|
|
|
|
int16 tmpy = om->Xyvo[1];
|
|
|
|
int16 tmpz = om->Xyvo[2];
|
2019-11-04 22:24:37 +01:00
|
|
|
om->Xyna[0][0] += om->Xyna[0][1];
|
|
|
|
if (om->Xyna[0][1] < 0) {
|
|
|
|
if (om->Xyna[0][0] < -1000) {
|
|
|
|
om->Xyna[0][0] += 1000;
|
|
|
|
--tmpx;
|
|
|
|
}
|
|
|
|
} else if (om->Xyna[0][0] > 1000) {
|
|
|
|
om->Xyna[0][0] -= 1000;
|
|
|
|
++tmpx;
|
|
|
|
}
|
|
|
|
om->Xyna[1][0] += om->Xyna[1][1];
|
|
|
|
if (om->Xyna[1][1] < 0) {
|
|
|
|
if (om->Xyna[1][0] < -1000) {
|
|
|
|
om->Xyna[1][0] += 1000;
|
|
|
|
--tmpy;
|
|
|
|
}
|
|
|
|
} else if (om->Xyna[1][0] > 1000) {
|
|
|
|
om->Xyna[1][0] -= 1000;
|
|
|
|
++tmpy;
|
|
|
|
}
|
|
|
|
om->Xyna[2][0] += om->Xyna[2][1];
|
|
|
|
if (om->Xyna[2][1] < 0) {
|
|
|
|
if (om->Xyna[2][0] < -1000) {
|
|
|
|
om->Xyna[2][0] += 1000;
|
|
|
|
--tmpz;
|
|
|
|
}
|
|
|
|
} else if (om->Xyna[2][0] > 1000) {
|
|
|
|
om->Xyna[2][0] -= 1000;
|
|
|
|
++tmpz;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mi->Mode) {
|
2022-02-13 17:46:17 -08:00
|
|
|
if (!(u_index = _G(ged)->ged_idx(om->Xypos[0] + mi->HotX + tmpx,
|
2019-11-04 22:24:37 +01:00
|
|
|
om->Xypos[1] + mi->HotY + tmpy,
|
2022-02-13 18:37:34 -08:00
|
|
|
_G(room)->_gedXAnz[_G(room_blk).AkAblage],
|
|
|
|
_G(ged_mem)[_G(room_blk).AkAblage]))) {
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-13 17:46:17 -08:00
|
|
|
if (!(u_index = _G(ged)->ged_idx(om->Xypos[0] + mi->HotX + tmpx,
|
2019-11-04 22:24:37 +01:00
|
|
|
om->Xypos[1] + mi->HotY,
|
2022-02-13 18:37:34 -08:00
|
|
|
_G(room)->_gedXAnz[_G(room_blk).AkAblage],
|
|
|
|
_G(ged_mem)[_G(room_blk).AkAblage]))) {
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-13 17:46:17 -08:00
|
|
|
if (!(u_index = _G(ged)->ged_idx(om->Xypos[0] + mi->HotX,
|
2019-11-04 22:24:37 +01:00
|
|
|
om->Xypos[1] + mi->HotY + tmpy,
|
2022-02-13 18:37:34 -08:00
|
|
|
_G(room)->_gedXAnz[_G(room_blk).AkAblage],
|
|
|
|
_G(ged_mem)[_G(room_blk).AkAblage]))) {
|
2019-11-04 22:24:37 +01:00
|
|
|
om->Count = 0;
|
|
|
|
} else {
|
|
|
|
if (!tmpy) {
|
|
|
|
if (om->Xyna[1][1] < 0)
|
|
|
|
tmpy = -1;
|
|
|
|
else
|
|
|
|
tmpy = 1;
|
|
|
|
}
|
|
|
|
if (mi->Id == CHEWY_OBJ)
|
|
|
|
check_shad(u_index, 1);
|
|
|
|
|
|
|
|
if (abs(om->Xypos[1] - mi->XyzEnd[1]) <= abs(tmpy)) {
|
|
|
|
om->Count = 0;
|
2022-02-13 18:37:34 -08:00
|
|
|
if (!_G(flags).NoEndPosMovObj) {
|
2019-11-04 22:24:37 +01:00
|
|
|
mi->XyzStart[0] = mi->XyzEnd[0];
|
|
|
|
mi->XyzStart[1] = mi->XyzEnd[1];
|
|
|
|
om->Xypos[0] = mi->XyzEnd[0];
|
|
|
|
om->Xypos[1] = mi->XyzEnd[1];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
om->Xypos[1] += tmpy;
|
|
|
|
om->Xypos[2] += tmpz;
|
|
|
|
mi->XyzStart[0] = om->Xypos[0];
|
|
|
|
mi->XyzStart[1] = om->Xypos[1];
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(mov)->get_mov_vector(mi->XyzStart, mi->Vorschub, om);
|
2019-11-04 22:24:37 +01:00
|
|
|
if (om->Xyvo[1] != 0) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(new_vector) = true;
|
2019-11-04 22:24:37 +01:00
|
|
|
swap_if_l(&om->Xyvo[1], &om->Xyvo[0]);
|
|
|
|
}
|
|
|
|
get_phase(om, mi);
|
2022-02-13 18:37:34 -08:00
|
|
|
if (om->Count == 0 && !_G(flags).NoEndPosMovObj) {
|
2019-11-04 22:24:37 +01:00
|
|
|
mi->XyzStart[0] = mi->XyzEnd[0];
|
|
|
|
mi->XyzStart[1] = mi->XyzEnd[1];
|
|
|
|
om->Xypos[0] = mi->XyzEnd[0];
|
|
|
|
om->Xypos[1] = mi->XyzEnd[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!tmpx) {
|
|
|
|
if (om->Xyna[0][1] < 0)
|
|
|
|
tmpx = -1;
|
|
|
|
else
|
|
|
|
tmpx = 1;
|
|
|
|
}
|
|
|
|
if (mi->Id == CHEWY_OBJ)
|
|
|
|
check_shad(u_index, 1);
|
|
|
|
|
|
|
|
if (abs(om->Xypos[0] - mi->XyzEnd[0]) <= abs(tmpx)) {
|
|
|
|
om->Count = 0;
|
2022-02-13 18:37:34 -08:00
|
|
|
if (!_G(flags).NoEndPosMovObj) {
|
2019-11-04 22:24:37 +01:00
|
|
|
mi->XyzStart[0] = mi->XyzEnd[0];
|
|
|
|
mi->XyzStart[1] = mi->XyzEnd[1];
|
|
|
|
om->Xypos[0] = mi->XyzEnd[0];
|
|
|
|
om->Xypos[1] = mi->XyzEnd[1];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
om->Xypos[0] += tmpx;
|
|
|
|
om->Xypos[2] += tmpz;
|
|
|
|
mi->XyzStart[0] = om->Xypos[0];
|
|
|
|
mi->XyzStart[1] = om->Xypos[1];
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(mov)->get_mov_vector(mi->XyzStart, mi->Vorschub, om);
|
2019-11-04 22:24:37 +01:00
|
|
|
if (om->Xyvo[0] != 0) {
|
2022-02-10 21:52:20 -08:00
|
|
|
_G(new_vector) = true;
|
2019-11-04 22:24:37 +01:00
|
|
|
swap_if_l(&om->Xyvo[0], &om->Xyvo[1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
get_lr_phase(om, mi->Id);
|
2022-02-13 18:37:34 -08:00
|
|
|
if (om->Count == 0 && !_G(flags).NoEndPosMovObj) {
|
2019-11-04 22:24:37 +01:00
|
|
|
mi->XyzStart[0] = mi->XyzEnd[0];
|
|
|
|
mi->XyzStart[1] = mi->XyzEnd[1];
|
|
|
|
om->Xypos[0] = mi->XyzEnd[0];
|
|
|
|
om->Xypos[1] = mi->XyzEnd[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (mi->Id == CHEWY_OBJ)
|
|
|
|
check_shad(u_index, 1);
|
|
|
|
om->Xypos[0] += tmpx;
|
|
|
|
om->Xypos[1] += tmpy;
|
|
|
|
om->Xypos[2] += tmpz;
|
2022-02-10 21:52:20 -08:00
|
|
|
if (_G(new_vector)) {
|
|
|
|
_G(new_vector) = false;
|
2019-11-04 22:24:37 +01:00
|
|
|
mi->XyzStart[0] = om->Xypos[0];
|
|
|
|
mi->XyzStart[1] = om->Xypos[1];
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(mov)->get_mov_vector(mi->XyzStart, mi->Vorschub, om);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
2022-02-13 18:37:34 -08:00
|
|
|
if (om->Count == 0 && !_G(flags).NoEndPosMovObj) {
|
2019-11-04 22:24:37 +01:00
|
|
|
mi->XyzStart[0] = mi->XyzEnd[0];
|
|
|
|
mi->XyzStart[1] = mi->XyzEnd[1];
|
|
|
|
om->Xypos[0] = mi->XyzEnd[0];
|
|
|
|
om->Xypos[1] = mi->XyzEnd[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
om->Xypos[0] += tmpx;
|
|
|
|
om->Xypos[1] += tmpy;
|
|
|
|
om->Xypos[2] += tmpz;
|
|
|
|
if (mi->Id == CHEWY_OBJ) {
|
2022-02-13 17:46:17 -08:00
|
|
|
u_index = _G(ged)->ged_idx(om->Xypos[0] + mi->HotX,
|
2019-11-04 22:24:37 +01:00
|
|
|
om->Xypos[1] + mi->HotY,
|
2022-02-13 18:37:34 -08:00
|
|
|
_G(room)->_gedXAnz[_G(room_blk).AkAblage],
|
|
|
|
_G(ged_mem)[_G(room_blk).AkAblage]);
|
2019-11-04 22:24:37 +01:00
|
|
|
check_shad(u_index, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mi->Id == CHEWY_OBJ) {
|
|
|
|
if (u_index >= 50 && u_index < 62)
|
|
|
|
check_ged_action(u_index);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (mi->Id) {
|
|
|
|
case CHEWY_OBJ:
|
2022-02-13 17:32:26 -08:00
|
|
|
if (!_G(spz_ani)[P_CHEWY])
|
2019-11-04 22:24:37 +01:00
|
|
|
calc_person_end_ani(om, P_CHEWY);
|
|
|
|
else
|
|
|
|
calc_person_spz_ani(om);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HOWARD_OBJ:
|
2022-02-13 17:32:26 -08:00
|
|
|
if (!_G(spz_ani)[P_HOWARD])
|
2019-11-04 22:24:37 +01:00
|
|
|
calc_person_end_ani(om, P_HOWARD);
|
|
|
|
else
|
|
|
|
calc_person_spz_ani(om);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NICHELLE_OBJ:
|
2022-02-13 17:32:26 -08:00
|
|
|
if (!_G(spz_ani)[P_NICHELLE])
|
2019-11-04 22:24:37 +01:00
|
|
|
calc_person_end_ani(om, P_NICHELLE);
|
|
|
|
else
|
|
|
|
calc_person_spz_ani(om);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NO_MOV_OBJ:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
new_auto_line(mi->Id);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void calc_person_end_ani(ObjMov *om, int16 p_nr) {
|
2022-02-13 18:25:29 -08:00
|
|
|
if (_G(ani_stand_count)[p_nr] >= 25 * (_G(spieler).DelaySpeed + p_nr * 2)) {
|
|
|
|
_G(ani_stand_count)[p_nr] = 0;
|
2019-11-04 22:24:37 +01:00
|
|
|
om->PhNr = 0;
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(ani_stand_flag)[p_nr] = true;
|
|
|
|
set_person_spr(_G(person_end_phase)[p_nr], p_nr);
|
|
|
|
} else if (_G(ani_stand_flag)[p_nr]) {
|
2021-11-14 16:35:08 -08:00
|
|
|
om->Delay = _G(spieler).DelaySpeed + 1;
|
2019-11-04 22:24:37 +01:00
|
|
|
if (om->PhNr < om->PhAnz - 1)
|
|
|
|
++om->PhNr;
|
|
|
|
else
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(ani_stand_flag)[p_nr] = false;
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
2022-02-13 18:25:29 -08:00
|
|
|
set_person_spr(_G(person_end_phase)[p_nr], p_nr);
|
2019-11-04 22:24:37 +01:00
|
|
|
om->PhNr = 0;
|
2022-02-13 18:25:29 -08:00
|
|
|
++_G(ani_stand_count)[p_nr];
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void get_phase(ObjMov *om, MovInfo *mi) {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 p_nr = 255 - mi->Id;
|
2019-11-04 22:24:37 +01:00
|
|
|
if (p_nr >= 0) {
|
|
|
|
if (om->Xyvo[0] > 0) {
|
|
|
|
if (om->Xyvo[1] > 0) {
|
|
|
|
|
|
|
|
if (om->Xyvo[1] > (mi->Vorschub - 1)) {
|
|
|
|
om->Phase = CH_DOWN;
|
2021-11-14 16:35:08 -08:00
|
|
|
if (om->Xypos[0] - _G(spieler).scrollx > SCREEN_WIDTH / 2)
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_LEFT;
|
2019-11-04 22:24:37 +01:00
|
|
|
else
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_RIGHT;
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
|
|
|
om->Phase = CH_RIGHT_NO;
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_RIGHT;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (om->Xyvo[1] < - (mi->Vorschub - 1)) {
|
|
|
|
om->Phase = CH_UP;
|
2021-11-14 16:35:08 -08:00
|
|
|
if (om->Xypos[0] - _G(spieler).scrollx > SCREEN_WIDTH / 2)
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_LEFT;
|
2019-11-04 22:24:37 +01:00
|
|
|
else
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_RIGHT;
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_RIGHT;
|
2019-11-04 22:24:37 +01:00
|
|
|
om->Phase = CH_RIGHT_NO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (om->Xyvo[1] > 0) {
|
|
|
|
|
|
|
|
if (om->Xyvo[1] > (mi->Vorschub - 1)) {
|
|
|
|
om->Phase = CH_DOWN;
|
2021-11-14 16:35:08 -08:00
|
|
|
if (om->Xypos[0] - _G(spieler).scrollx > SCREEN_WIDTH / 2)
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_LEFT;
|
2019-11-04 22:24:37 +01:00
|
|
|
else
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_RIGHT;
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_LEFT;
|
2019-11-04 22:24:37 +01:00
|
|
|
om->Phase = CH_LEFT_NO;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (om->Xyvo[1] < -(mi->Vorschub - 1)) {
|
|
|
|
om->Phase = CH_UP;
|
2021-11-14 16:35:08 -08:00
|
|
|
if (om->Xypos[0] - _G(spieler).scrollx > SCREEN_WIDTH / 2)
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_LEFT;
|
2019-11-04 22:24:37 +01:00
|
|
|
else
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_RIGHT;
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(person_end_phase)[p_nr] = P_LEFT;
|
2019-11-04 22:24:37 +01:00
|
|
|
om->Phase = CH_LEFT_NO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void get_lr_phase(ObjMov *om, int16 mode) {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 p_nr = 255 - mode;
|
2019-11-04 22:24:37 +01:00
|
|
|
if (p_nr >= 0) {
|
|
|
|
if (om->Xyvo[0] > 0) {
|
|
|
|
om->Phase = CH_RIGHT_NO;
|
|
|
|
} else {
|
|
|
|
om->Phase = CH_LEFT_NO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void zoom_mov_anpass(ObjMov *om, MovInfo *mi) {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 tmp_vorschub = mi->Vorschub;
|
2019-11-04 22:24:37 +01:00
|
|
|
mi->Vorschub = CH_X_PIX;
|
2022-02-13 18:37:34 -08:00
|
|
|
if (_G(flags).ZoomMov) {
|
2021-11-14 16:02:05 -08:00
|
|
|
if (om->Xzoom < 0 && _G(zoom_mov_fak) > 0) {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 tmp = om->Xzoom / _G(zoom_mov_fak);
|
2019-11-04 22:24:37 +01:00
|
|
|
tmp = abs(tmp);
|
|
|
|
mi->Vorschub -= tmp;
|
|
|
|
if (mi->Vorschub < 2)
|
|
|
|
mi->Vorschub = 2;
|
|
|
|
}
|
|
|
|
if (tmp_vorschub != mi->Vorschub && om->Count) {
|
2022-02-13 17:46:17 -08:00
|
|
|
_G(mov)->get_mov_vector((int16 *)mi->XyzStart, mi->Vorschub, om);
|
2019-11-04 22:24:37 +01:00
|
|
|
get_phase(om, mi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void start_spz_wait(int16 ani_id, int16 count, bool reverse, int16 p_nr) {
|
|
|
|
if (start_spz(ani_id, count, reverse, p_nr)) {
|
2022-02-13 17:32:26 -08:00
|
|
|
while (_G(spz_count) && !SHOULD_QUIT)
|
2019-11-04 22:24:37 +01:00
|
|
|
set_up_screen(DO_SETUP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool start_spz(int16 ani_id, int16 count, bool reverse, int16 p_nr) {
|
|
|
|
bool ret = false;
|
2022-02-13 18:37:34 -08:00
|
|
|
if (!_G(flags).SpzAni) {
|
|
|
|
_G(flags).SpzAni = true;
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(spz_ani)[p_nr] = true;
|
|
|
|
_G(spz_p_nr) = p_nr;
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 spr_start = SPZ_ANI_PH[ani_id][0];
|
|
|
|
int16 spr_anz = SPZ_ANI_PH[ani_id][1];
|
2022-02-13 18:25:29 -08:00
|
|
|
if (_G(person_end_phase)[p_nr] == P_RIGHT) {
|
2019-11-04 22:24:37 +01:00
|
|
|
ani_id += 100;
|
|
|
|
spr_start += CH_SPZ_OFFSET;
|
|
|
|
}
|
|
|
|
|
2022-02-13 17:32:26 -08:00
|
|
|
if (ani_id != _G(spz_akt_id)) {
|
|
|
|
if (_G(spz_tinfo))
|
|
|
|
free((char *)_G(spz_tinfo));
|
|
|
|
_G(spz_akt_id) = ani_id;
|
|
|
|
_G(spz_tinfo) = _G(mem)->taf_seq_adr(spr_start, spr_anz);
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
2021-10-27 22:17:12 -07:00
|
|
|
|
2022-02-20 23:25:38 +01:00
|
|
|
for (int16 i = 0; i < spr_anz; i++) {
|
2019-11-04 22:24:37 +01:00
|
|
|
if (!reverse)
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(spz_spr_nr)[i] = i;
|
2019-11-04 22:24:37 +01:00
|
|
|
else
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(spz_spr_nr)[i] = spr_anz - i - 1;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
2021-10-27 22:17:12 -07:00
|
|
|
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(spz_start) = spr_start;
|
|
|
|
_G(spz_delay)[p_nr] = _G(SpzDelay);
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[p_nr].Count = 0;
|
|
|
|
_G(spieler_vector)[p_nr].PhNr = 0;
|
|
|
|
_G(spieler_vector)[p_nr].PhAnz = spr_anz;
|
|
|
|
_G(spieler_vector)[p_nr].Delay = _G(spieler).DelaySpeed + _G(spz_delay)[p_nr];
|
|
|
|
_G(spieler_vector)[p_nr].DelayCount = 0;
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(spz_count) = count;
|
2022-02-13 18:37:34 -08:00
|
|
|
_G(flags).MausLinks = true;
|
2019-11-04 22:24:37 +01:00
|
|
|
ret = true;
|
|
|
|
}
|
2021-10-25 20:29:21 -07:00
|
|
|
return ret;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void calc_person_spz_ani(ObjMov *om) {
|
|
|
|
if (om->PhNr < om->PhAnz - 1)
|
|
|
|
++om->PhNr;
|
|
|
|
else {
|
2022-02-13 17:32:26 -08:00
|
|
|
--_G(spz_count);
|
|
|
|
if (_G(spz_count) > 0) {
|
2019-11-04 22:24:37 +01:00
|
|
|
om->PhNr = 0;
|
2022-02-13 17:32:26 -08:00
|
|
|
om->Delay = _G(spieler).DelaySpeed + _G(spz_delay)[_G(spz_p_nr)];
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
2022-02-13 17:32:26 -08:00
|
|
|
if (_G(spz_count) != 255)
|
2019-11-04 22:24:37 +01:00
|
|
|
stop_spz();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void stop_spz() {
|
2022-02-13 18:37:34 -08:00
|
|
|
if (_G(flags).SpzAni) {
|
|
|
|
_G(flags).SpzAni = false;
|
|
|
|
_G(flags).MausLinks = false;
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(spz_ani)[_G(spz_p_nr)] = false;
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[_G(spz_p_nr)].Count = 0;
|
|
|
|
_G(spieler_vector)[_G(spz_p_nr)].PhNr = 0;
|
|
|
|
set_person_spr(_G(person_end_phase)[_G(spz_p_nr)], _G(spz_p_nr));
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(spz_delay)[_G(spz_p_nr)] = 0;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_spz_delay(int16 delay) {
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(SpzDelay) = delay;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void load_person_ani(int16 ani_id, int16 p_nr) {
|
2022-02-13 17:32:26 -08:00
|
|
|
if (_G(PersonAni)[p_nr] != ani_id) {
|
2022-02-20 23:25:38 +01:00
|
|
|
int16 ani_start = SPZ_ANI_PH[ani_id][0];
|
|
|
|
short ani_anz = SPZ_ANI_PH[ani_id][1];
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(PersonAni)[p_nr] = ani_id;
|
|
|
|
if (_G(PersonTaf)[p_nr])
|
|
|
|
free((char *)_G(PersonTaf)[p_nr]);
|
|
|
|
_G(PersonTaf)[p_nr] = _G(mem)->taf_seq_adr(ani_start, ani_anz);
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[p_nr].PhNr = 0;
|
|
|
|
_G(spieler_vector)[p_nr].PhAnz = ani_anz;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 p_ani[MAX_PERSON - 1][5] = {
|
|
|
|
{HO_WALK_L, HO_WALK_R, HO_BACK, HO_FRONT, HO_STAND_L},
|
|
|
|
{NI_WALK_L, NI_WALK_R, NI_BACK, NI_FRONT, NI_STAND_L}
|
|
|
|
};
|
|
|
|
|
|
|
|
void calc_person_ani() {
|
|
|
|
int16 ani_nr = 0;
|
2022-02-20 23:25:38 +01:00
|
|
|
for (int16 p_nr = 0; p_nr < MAX_PERSON; p_nr++) {
|
2022-02-13 18:25:29 -08:00
|
|
|
if (_G(spieler_mi)[p_nr].Id != NO_MOV_OBJ) {
|
2019-11-04 22:24:37 +01:00
|
|
|
switch (p_nr) {
|
|
|
|
case P_CHEWY:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case P_HOWARD:
|
|
|
|
case P_NICHELLE:
|
2022-02-13 17:32:26 -08:00
|
|
|
if (!_G(spz_ani)[p_nr]) {
|
2022-02-20 23:25:38 +01:00
|
|
|
for (int16 i = 0; i < 8; i++)
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(PersonSpr)[p_nr][i] = i;
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-13 18:25:29 -08:00
|
|
|
if (!_G(spieler_vector)[p_nr].Count &&
|
2021-11-14 16:02:05 -08:00
|
|
|
_G(auto_p_nr) != p_nr) {
|
2022-02-13 18:25:29 -08:00
|
|
|
ani_nr = (int16)p_ani[p_nr - 1][4] + (_G(person_end_phase)[p_nr] * 4);
|
2019-11-04 22:24:37 +01:00
|
|
|
|
2022-02-13 18:25:29 -08:00
|
|
|
_G(spieler_vector)[p_nr].PhAnz = 5;
|
2022-02-13 17:32:26 -08:00
|
|
|
_G(PersonSpr)[p_nr][3] = 1;
|
|
|
|
_G(PersonSpr)[p_nr][4] = 0;
|
2019-11-04 22:24:37 +01:00
|
|
|
} else {
|
2022-02-13 18:25:29 -08:00
|
|
|
switch (_G(spieler_vector)[p_nr].Phase) {
|
2019-11-04 22:24:37 +01:00
|
|
|
case CH_LEFT_NO:
|
|
|
|
ani_nr = (int16)p_ani[p_nr - 1][0];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CH_RIGHT_NO:
|
|
|
|
ani_nr = (int16)p_ani[p_nr - 1][1];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CH_UP:
|
|
|
|
ani_nr = (int16)p_ani[p_nr - 1][2];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CH_DOWN:
|
|
|
|
ani_nr = (int16)p_ani[p_nr - 1][3];
|
|
|
|
break;
|
2022-02-20 23:25:38 +01:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
load_person_ani(ani_nr, p_nr);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2021-10-27 20:20:58 -07:00
|
|
|
default:
|
|
|
|
break;
|
2019-11-04 22:24:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-09-12 15:41:09 -07:00
|
|
|
|
|
|
|
} // namespace Chewy
|