2012-10-02 11:44:23 +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.
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* 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
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common/system.h"
|
|
|
|
#include "common/textconsole.h"
|
|
|
|
#include "hopkins/lines.h"
|
|
|
|
#include "hopkins/graphics.h"
|
|
|
|
#include "hopkins/hopkins.h"
|
|
|
|
|
|
|
|
namespace Hopkins {
|
|
|
|
|
2012-10-06 13:36:13 +00:00
|
|
|
LinesManager::LinesManager() {
|
2013-01-10 21:09:37 +00:00
|
|
|
for (int i = 0; i < MAX_LINES; ++i) {
|
2012-12-30 23:18:08 +00:00
|
|
|
Common::fill((byte *)&_zoneLine[i], (byte *)&_zoneLine[i] + sizeof(LigneZoneItem), 0);
|
2012-10-06 13:36:13 +00:00
|
|
|
Common::fill((byte *)&Ligne[i], (byte *)&Ligne[i] + sizeof(LigneItem), 0);
|
|
|
|
}
|
|
|
|
for (int i = 0; i < 4000; ++i) {
|
|
|
|
Common::fill((byte *)&SMOOTH[i], (byte *)&SMOOTH[i] + sizeof(SmoothItem), 0);
|
|
|
|
}
|
|
|
|
|
2013-01-01 23:57:00 +00:00
|
|
|
_linesNumb = 0;
|
2012-10-06 13:36:13 +00:00
|
|
|
NV_LIGNEDEP = 0;
|
|
|
|
NV_LIGNEOFS = 0;
|
|
|
|
NV_POSI = 0;
|
|
|
|
NVPX = 0;
|
|
|
|
NVPY = 0;
|
|
|
|
SMOOTH_SENS = 0;
|
|
|
|
SMOOTH_X = SMOOTH_Y = 0;
|
|
|
|
}
|
|
|
|
|
2012-10-02 11:44:23 +00:00
|
|
|
void LinesManager::setParent(HopkinsEngine *vm) {
|
|
|
|
_vm = vm;
|
|
|
|
}
|
|
|
|
|
2013-01-11 00:50:29 +00:00
|
|
|
/**
|
|
|
|
* Clear all zones and reset nextLine
|
|
|
|
*/
|
|
|
|
void LinesManager::clearAllZones() {
|
2013-01-10 21:09:37 +00:00
|
|
|
for (int idx = 0; idx < MAX_LINES; ++idx)
|
2012-12-30 23:18:08 +00:00
|
|
|
removeZoneLine(idx);
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
|
2013-01-10 22:15:52 +00:00
|
|
|
/**
|
|
|
|
* Check Hotspots in Inventory screen
|
|
|
|
* Returns the ID of the hotspot under mouse
|
|
|
|
*/
|
|
|
|
int LinesManager::checkInventoryHotspots(int posX, int posY) {
|
|
|
|
int hotspotId = 0;
|
|
|
|
if (posY >= 120 && posY <= 153)
|
2013-01-11 23:38:23 +00:00
|
|
|
hotspotId = checkInventoryHotspotsRow(posX, 1, false);
|
2013-01-10 22:15:52 +00:00
|
|
|
if (posY >= 154 && posY <= 191)
|
2013-01-11 23:38:23 +00:00
|
|
|
hotspotId = checkInventoryHotspotsRow(posX, 7, false);
|
2013-01-10 22:15:52 +00:00
|
|
|
if (posY >= 192 && posY <= 229)
|
2013-01-11 23:38:23 +00:00
|
|
|
hotspotId = checkInventoryHotspotsRow(posX, 13, false);
|
2013-01-10 22:15:52 +00:00
|
|
|
if (posY >= 230 && posY <= 267)
|
2013-01-11 23:38:23 +00:00
|
|
|
hotspotId = checkInventoryHotspotsRow(posX, 19, false);
|
2013-01-10 22:15:52 +00:00
|
|
|
if (posY >= 268 && posY <= 306)
|
2013-01-11 23:38:23 +00:00
|
|
|
hotspotId = checkInventoryHotspotsRow(posX, 25, true);
|
2013-01-10 22:15:52 +00:00
|
|
|
if (posY >= 268 && posY <= 288 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478)
|
|
|
|
hotspotId = 30;
|
|
|
|
if (posY >= 290 && posY <= 306 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478)
|
|
|
|
hotspotId = 31;
|
|
|
|
if (posY < 114 || posY > 306 || posX < _vm->_graphicsManager._scrollOffset + 152 || posX > _vm->_graphicsManager._scrollOffset + 484)
|
|
|
|
hotspotId = 32;
|
|
|
|
|
|
|
|
return hotspotId;
|
2012-10-03 12:15:39 +00:00
|
|
|
}
|
|
|
|
|
2013-01-10 22:15:52 +00:00
|
|
|
/**
|
|
|
|
* Check the hotspots in an inventory line
|
|
|
|
* Returns the hotspot Id under the mouse, if any.
|
|
|
|
*/
|
2013-01-11 23:38:23 +00:00
|
|
|
int LinesManager::checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow) {
|
2012-12-30 23:18:08 +00:00
|
|
|
int result = minZoneNum;
|
2013-01-10 22:15:52 +00:00
|
|
|
if (posX >= _vm->_graphicsManager._scrollOffset + 158 && posX < _vm->_graphicsManager._scrollOffset + 208)
|
2012-12-30 23:18:08 +00:00
|
|
|
return result;
|
|
|
|
|
2013-01-10 22:15:52 +00:00
|
|
|
if (posX >= _vm->_graphicsManager._scrollOffset + 208 && posX < _vm->_graphicsManager._scrollOffset + 266) {
|
2012-12-30 23:18:08 +00:00
|
|
|
result += 1;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-01-10 22:15:52 +00:00
|
|
|
if (posX >= _vm->_graphicsManager._scrollOffset + 266 && posX < _vm->_graphicsManager._scrollOffset + 320) {
|
2012-12-30 23:18:08 +00:00
|
|
|
result += 2;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-01-10 22:15:52 +00:00
|
|
|
if (posX >= _vm->_graphicsManager._scrollOffset + 320 && posX < _vm->_graphicsManager._scrollOffset + 370) {
|
2012-12-30 23:18:08 +00:00
|
|
|
result += 3;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-01-10 22:15:52 +00:00
|
|
|
if (posX >= _vm->_graphicsManager._scrollOffset + 370 && posX < _vm->_graphicsManager._scrollOffset + 424) {
|
2012-12-30 23:18:08 +00:00
|
|
|
result += 4;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-01-01 12:53:07 +00:00
|
|
|
if (!lastRow && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) {
|
2012-12-30 23:18:08 +00:00
|
|
|
result += 5;
|
|
|
|
return result;
|
2012-10-03 12:15:39 +00:00
|
|
|
}
|
2012-12-30 23:18:08 +00:00
|
|
|
|
|
|
|
return 0;
|
2012-10-03 12:15:39 +00:00
|
|
|
}
|
|
|
|
|
2012-12-30 23:18:08 +00:00
|
|
|
/**
|
|
|
|
* Remove Zone Line
|
|
|
|
*/
|
|
|
|
void LinesManager::removeZoneLine(int idx) {
|
2013-01-10 21:09:37 +00:00
|
|
|
if (idx > MAX_LINES)
|
2012-12-30 23:18:08 +00:00
|
|
|
error("Attempting to remove a line obstacle > MAX_LIGNE.");
|
2012-10-02 11:44:23 +00:00
|
|
|
|
2013-01-24 07:04:58 +00:00
|
|
|
_zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData);
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
|
2012-12-30 23:18:08 +00:00
|
|
|
/**
|
|
|
|
* Add Zone Line
|
|
|
|
*/
|
|
|
|
void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx) {
|
2012-10-13 10:14:18 +00:00
|
|
|
int16 *zoneData;
|
2012-10-02 11:44:23 +00:00
|
|
|
|
2012-12-30 23:18:08 +00:00
|
|
|
if (a2 == a3 && a3 == a4 && a3 == a5) {
|
|
|
|
_vm->_globals.BOBZONE_FLAG[bobZoneIdx] = true;
|
|
|
|
_vm->_globals.BOBZONE[bobZoneIdx] = a3;
|
|
|
|
} else {
|
2013-01-10 21:09:37 +00:00
|
|
|
if (idx > MAX_LINES)
|
2012-10-02 11:44:23 +00:00
|
|
|
error("Attempting to add a line obstacle > MAX_LIGNE.");
|
2012-10-13 10:14:18 +00:00
|
|
|
|
2013-01-22 06:53:59 +00:00
|
|
|
_zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData);
|
2012-12-12 07:05:04 +00:00
|
|
|
|
2013-01-09 07:05:58 +00:00
|
|
|
int v8 = abs(a2 - a4);
|
|
|
|
int v9 = abs(a3 - a5);
|
2012-11-23 23:16:44 +00:00
|
|
|
int v20 = 1;
|
2012-12-30 23:18:08 +00:00
|
|
|
if (v8 <= v9)
|
2012-11-23 23:16:44 +00:00
|
|
|
v20 += v9;
|
2012-10-02 11:44:23 +00:00
|
|
|
else
|
2012-12-30 23:18:08 +00:00
|
|
|
v20 += v8;
|
2012-10-13 10:14:18 +00:00
|
|
|
|
2012-12-12 07:05:04 +00:00
|
|
|
zoneData = (int16 *)_vm->_globals.allocMemory(2 * sizeof(int16) * v20 + (4 * sizeof(int16)));
|
2012-11-23 23:16:44 +00:00
|
|
|
int v11 = idx;
|
2013-01-22 06:53:59 +00:00
|
|
|
_zoneLine[v11]._zoneData = zoneData;
|
2012-10-13 10:14:18 +00:00
|
|
|
if (zoneData == (int16 *)g_PTRNUL)
|
2012-10-02 11:44:23 +00:00
|
|
|
error("AJOUTE LIGNE ZONE");
|
|
|
|
|
2012-11-23 23:16:44 +00:00
|
|
|
int16 *dataP = zoneData;
|
2012-12-30 23:18:08 +00:00
|
|
|
int v23 = 1000 * v8 / v20;
|
|
|
|
int v22 = 1000 * v9 / v20;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (a4 < a2)
|
|
|
|
v23 = -v23;
|
|
|
|
if (a5 < a3)
|
|
|
|
v22 = -v22;
|
2012-11-23 23:16:44 +00:00
|
|
|
int v13 = 1000 * a2;
|
|
|
|
int v16 = 1000 * a3;
|
2012-12-22 00:28:31 +00:00
|
|
|
for (int i = 0; i < v20; i++) {
|
2012-12-30 23:18:08 +00:00
|
|
|
*dataP++ = v13 / 1000;
|
|
|
|
*dataP++ = v16 / 1000;
|
2012-12-22 00:28:31 +00:00
|
|
|
|
|
|
|
v13 += v23;
|
|
|
|
v16 += v22;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2012-10-13 10:14:18 +00:00
|
|
|
*dataP++ = -1;
|
|
|
|
*dataP++ = -1;
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2013-01-22 06:53:59 +00:00
|
|
|
_zoneLine[idx]._count = v20;
|
2012-12-30 23:18:08 +00:00
|
|
|
_zoneLine[idx].field2 = bobZoneIdx;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-10 21:09:37 +00:00
|
|
|
void LinesManager::resetLines() {
|
|
|
|
for (int idx = 0; idx < MAX_LINES; ++idx) {
|
|
|
|
removeLine(idx);
|
2013-01-10 07:28:15 +00:00
|
|
|
Ligne[idx]._lineDataEndIdx = 0;
|
|
|
|
Ligne[idx]._lineData = (int16 *)g_PTRNUL;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-20 16:59:06 +00:00
|
|
|
// Remove Line
|
2013-01-10 21:09:37 +00:00
|
|
|
void LinesManager::removeLine(int idx) {
|
|
|
|
if (idx > MAX_LINES)
|
2012-10-02 11:44:23 +00:00
|
|
|
error("Attempting to add a line obstacle > MAX_LIGNE.");
|
2013-01-10 07:28:15 +00:00
|
|
|
Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData);
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
|
2013-01-11 00:50:29 +00:00
|
|
|
/**
|
|
|
|
* Add Line
|
|
|
|
*/
|
|
|
|
void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int a7) {
|
2012-12-14 00:49:22 +00:00
|
|
|
int v7;
|
|
|
|
int v8;
|
|
|
|
int v9;
|
|
|
|
byte *v10;
|
|
|
|
int v11;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v12;
|
|
|
|
int v13;
|
|
|
|
int v24;
|
|
|
|
int v25;
|
2012-10-19 22:16:25 +00:00
|
|
|
int16 *v27;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v30;
|
|
|
|
int v31;
|
2012-10-19 22:16:25 +00:00
|
|
|
int16 *v32;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v33;
|
|
|
|
int v34;
|
|
|
|
int v35;
|
|
|
|
int v36;
|
|
|
|
int v37;
|
|
|
|
int v38;
|
|
|
|
int v39;
|
|
|
|
int v40;
|
|
|
|
|
2013-01-10 21:09:37 +00:00
|
|
|
if (idx > MAX_LINES)
|
2012-10-02 11:44:23 +00:00
|
|
|
error("Attempting to add a line obstacle > MAX_LIGNE.");
|
2013-01-02 14:04:12 +00:00
|
|
|
|
2013-01-01 23:57:00 +00:00
|
|
|
if (_linesNumb < idx)
|
|
|
|
_linesNumb = idx;
|
2012-10-02 11:44:23 +00:00
|
|
|
|
2013-01-10 07:28:15 +00:00
|
|
|
Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData);
|
2013-01-09 07:05:58 +00:00
|
|
|
v7 = abs(a3 - a5);
|
2012-10-02 11:44:23 +00:00
|
|
|
v8 = v7 + 1;
|
2013-01-09 07:05:58 +00:00
|
|
|
v9 = abs(a4 - a6);
|
2012-10-02 11:44:23 +00:00
|
|
|
v34 = v9 + 1;
|
|
|
|
v33 = v9 + 1;
|
2013-01-09 07:05:58 +00:00
|
|
|
if (v8 > v34)
|
2012-10-02 11:44:23 +00:00
|
|
|
v34 = v8;
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2012-12-12 07:05:04 +00:00
|
|
|
v10 = _vm->_globals.allocMemory(4 * v34 + 8);
|
2012-10-10 10:03:29 +00:00
|
|
|
if (v10 == g_PTRNUL)
|
2012-10-02 11:44:23 +00:00
|
|
|
error("AJOUTE LIGNE OBSTACLE");
|
2012-10-24 22:13:31 +00:00
|
|
|
|
|
|
|
Common::fill(v10, v10 + 4 * v34 + 8, 0);
|
2013-01-10 07:28:15 +00:00
|
|
|
Ligne[idx]._lineData = (int16 *)v10;
|
2012-10-19 22:16:25 +00:00
|
|
|
|
2013-01-10 07:28:15 +00:00
|
|
|
v32 = Ligne[idx]._lineData;
|
2012-10-02 11:44:23 +00:00
|
|
|
v36 = 1000 * v8;
|
|
|
|
v39 = 1000 * v8 / (v34 - 1);
|
|
|
|
v37 = 1000 * v33 / (v34 - 1);
|
|
|
|
if (a5 < a3)
|
|
|
|
v39 = -v39;
|
|
|
|
if (a6 < a4)
|
|
|
|
v37 = -v37;
|
|
|
|
v11 = (int)v39 / 1000;
|
|
|
|
v12 = (int)v37 / 1000;
|
|
|
|
v13 = (int)v37 / 1000;
|
|
|
|
if (!((int)v39 / 1000)) {
|
|
|
|
if (v12 == -1) {
|
|
|
|
Ligne[idx].field6 = 1;
|
|
|
|
Ligne[idx].field8 = 5;
|
|
|
|
}
|
|
|
|
if (v12 == 1) {
|
|
|
|
Ligne[idx].field6 = 5;
|
|
|
|
Ligne[idx].field8 = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (v11 == 1) {
|
|
|
|
if (v12 == -1) {
|
|
|
|
Ligne[idx].field6 = 2;
|
|
|
|
Ligne[idx].field8 = 6;
|
|
|
|
}
|
|
|
|
if (!v13) {
|
|
|
|
Ligne[idx].field6 = 3;
|
|
|
|
Ligne[idx].field8 = 7;
|
|
|
|
}
|
|
|
|
if (v13 == 1) {
|
|
|
|
Ligne[idx].field6 = 4;
|
|
|
|
Ligne[idx].field8 = 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (v11 == -1) {
|
|
|
|
if (v13 == 1) {
|
|
|
|
Ligne[idx].field6 = 6;
|
|
|
|
Ligne[idx].field8 = 2;
|
|
|
|
}
|
|
|
|
if (!v13) {
|
|
|
|
Ligne[idx].field6 = 7;
|
|
|
|
Ligne[idx].field8 = 3;
|
|
|
|
}
|
|
|
|
if (v13 == -1) {
|
|
|
|
Ligne[idx].field6 = 8;
|
|
|
|
Ligne[idx].field8 = 4;
|
|
|
|
}
|
|
|
|
}
|
2013-01-02 14:04:12 +00:00
|
|
|
if (v11 == 1 && v37 > 250 && v37 <= 999) {
|
2012-10-02 11:44:23 +00:00
|
|
|
Ligne[idx].field6 = 4;
|
|
|
|
Ligne[idx].field8 = 8;
|
|
|
|
}
|
2013-01-02 14:04:12 +00:00
|
|
|
if (v11 == -1 && v37 > 250 && v37 <= 999) {
|
2012-10-02 11:44:23 +00:00
|
|
|
Ligne[idx].field6 = 6;
|
|
|
|
Ligne[idx].field8 = 2;
|
|
|
|
}
|
2013-01-02 14:04:12 +00:00
|
|
|
if (v11 == 1 && v37 < -250 && v37 > -1000) {
|
2012-10-02 11:44:23 +00:00
|
|
|
Ligne[idx].field6 = 2;
|
|
|
|
Ligne[idx].field8 = 6;
|
|
|
|
}
|
2013-01-02 15:04:15 +00:00
|
|
|
// This condition is impossible to meet!
|
2013-01-02 14:04:12 +00:00
|
|
|
// Code present in the Linux and BeOS executables
|
2013-01-02 15:04:15 +00:00
|
|
|
// CHECKME: maybe it should be checking negative values?
|
2012-10-02 11:44:23 +00:00
|
|
|
if (v11 == -1 && v37 <= 249 && v37 > 1000) {
|
|
|
|
Ligne[idx].field6 = 8;
|
|
|
|
Ligne[idx].field8 = 4;
|
|
|
|
}
|
|
|
|
v40 = v36 / v34;
|
|
|
|
v38 = 1000 * v33 / v34;
|
|
|
|
if (a5 < a3)
|
|
|
|
v40 = -v40;
|
|
|
|
if (a6 < a4)
|
|
|
|
v38 = -v38;
|
|
|
|
v24 = 1000 * a3;
|
|
|
|
v25 = 1000 * a4;
|
|
|
|
v31 = 1000 * a3 / 1000;
|
|
|
|
v30 = 1000 * a4 / 1000;
|
|
|
|
v35 = v34 - 1;
|
2012-12-22 00:28:31 +00:00
|
|
|
for (int v26 = 0; v26 < v35; v26++) {
|
|
|
|
v32[0] = v31;
|
|
|
|
v32[1] = v30;
|
|
|
|
v32 += 2;
|
|
|
|
|
|
|
|
v24 += v40;
|
|
|
|
v25 += v38;
|
|
|
|
v31 = v24 / 1000;
|
|
|
|
v30 = v25 / 1000;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2012-10-19 22:16:25 +00:00
|
|
|
v32[0] = a5;
|
|
|
|
v32[1] = a6;
|
|
|
|
|
|
|
|
v27 = v32 + 2;
|
|
|
|
v27[0] = -1;
|
|
|
|
v27[1] = -1;
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2013-01-10 07:28:15 +00:00
|
|
|
Ligne[idx]._lineDataEndIdx = v35 + 1;
|
2012-10-02 11:44:23 +00:00
|
|
|
Ligne[idx].field2 = a7;
|
|
|
|
Ligne[idx].field4 = a2;
|
|
|
|
}
|
|
|
|
|
2013-01-10 07:28:15 +00:00
|
|
|
/**
|
|
|
|
* Check collision line
|
|
|
|
*/
|
|
|
|
bool LinesManager::checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx) {
|
|
|
|
int16 *lineData;
|
|
|
|
|
|
|
|
int left = xp + 4;
|
|
|
|
int right = xp - 4;
|
|
|
|
int top = yp + 4;
|
|
|
|
int bottom = yp - 4;
|
|
|
|
|
|
|
|
*foundDataIdx = -1;
|
|
|
|
*foundLineIdx = -1;
|
|
|
|
|
|
|
|
for (int curLineIdx = startLineIdx; curLineIdx <= endLineIdx; curLineIdx++) {
|
|
|
|
lineData = Ligne[curLineIdx]._lineData;
|
|
|
|
|
|
|
|
if (lineData == (int16 *)g_PTRNUL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
bool collisionFl = true;
|
|
|
|
int lineStartX = lineData[0];
|
|
|
|
int lineStartY = lineData[1];
|
|
|
|
int lineDataIdx = 2 * Ligne[curLineIdx]._lineDataEndIdx;
|
|
|
|
int lineEndX = lineData[lineDataIdx - 2];
|
|
|
|
int lineEndY = lineData[lineDataIdx - 1];
|
|
|
|
if (lineStartX >= lineEndX) {
|
|
|
|
if (right > lineStartX || left < lineEndX)
|
|
|
|
collisionFl = false;
|
|
|
|
} else { // lineStartX < lineEndX
|
|
|
|
if (left < lineStartX || right > lineEndX)
|
|
|
|
collisionFl = false;
|
|
|
|
}
|
|
|
|
if (lineStartY >= lineEndY) {
|
|
|
|
if (bottom > lineStartY || top < lineEndY)
|
|
|
|
collisionFl = false;
|
|
|
|
} else { // lineStartY < lineEndY
|
|
|
|
if (top < lineStartY || bottom > lineEndY)
|
|
|
|
collisionFl = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!collisionFl)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for (int idx = 0; idx < Ligne[curLineIdx]._lineDataEndIdx; idx++) {
|
|
|
|
int lineX = lineData[0];
|
|
|
|
int lineY = lineData[1];
|
|
|
|
lineData += 2;
|
|
|
|
|
|
|
|
if ((xp == lineX || xp + 1 == lineX) && (yp == lineY || yp + 1 == lineY)) {
|
|
|
|
*foundDataIdx = idx;
|
|
|
|
*foundLineIdx = curLineIdx;
|
|
|
|
return true;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-10 07:28:15 +00:00
|
|
|
return false;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
|
2013-01-10 19:10:16 +00:00
|
|
|
/**
|
|
|
|
* Init route
|
|
|
|
*/
|
|
|
|
void LinesManager::initRoute() {
|
|
|
|
int lineX = Ligne[0]._lineData[0];
|
|
|
|
int lineY = Ligne[0]._lineData[1];
|
|
|
|
|
|
|
|
int lineIdx = 1;
|
|
|
|
for (;;) {
|
|
|
|
int curDataIdx = Ligne[lineIdx]._lineDataEndIdx;
|
|
|
|
int16 *curLineData = Ligne[lineIdx]._lineData;
|
|
|
|
|
|
|
|
int curLineX = curLineData[2 * curDataIdx - 2];
|
|
|
|
int curLineY = curLineData[2 * curDataIdx - 1];
|
2013-01-20 10:28:39 +00:00
|
|
|
if (_vm->_graphicsManager._maxX == curLineX || _vm->_graphicsManager._maxY == curLineY ||
|
|
|
|
_vm->_graphicsManager._minX == curLineX || _vm->_graphicsManager._minY == curLineY ||
|
2013-01-10 19:10:16 +00:00
|
|
|
(lineX == curLineX && lineY == curLineY))
|
|
|
|
break;
|
2013-01-10 21:09:37 +00:00
|
|
|
if (lineIdx == MAX_LINES)
|
2012-10-02 11:44:23 +00:00
|
|
|
error("ERROR - LAST LINE NOT FOUND");
|
2012-12-31 00:09:06 +00:00
|
|
|
|
2013-01-10 19:10:16 +00:00
|
|
|
int16 *nextLineData = Ligne[lineIdx + 1]._lineData;
|
|
|
|
if (nextLineData[0] != curLineX && nextLineData[1] != curLineY)
|
|
|
|
break;
|
|
|
|
++lineIdx;
|
|
|
|
}
|
|
|
|
|
2013-01-10 20:40:46 +00:00
|
|
|
_vm->_objectsManager._lastLine = lineIdx;
|
2013-01-10 21:09:37 +00:00
|
|
|
for (int idx = 1; idx < MAX_LINES; idx++) {
|
2013-01-10 20:40:46 +00:00
|
|
|
if ((Ligne[idx]._lineDataEndIdx < _vm->_globals._maxLineLength) && (idx != _vm->_objectsManager._lastLine + 1)) {
|
2013-01-10 19:10:16 +00:00
|
|
|
Ligne[idx].field6 = Ligne[idx - 1].field6;
|
|
|
|
Ligne[idx].field8 = Ligne[idx - 1].field8;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2012-12-17 23:37:52 +00:00
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
|
2012-10-20 16:59:06 +00:00
|
|
|
// Avoid
|
2013-01-24 07:04:58 +00:00
|
|
|
int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7) {
|
2012-11-23 23:57:37 +00:00
|
|
|
int v36 = a1;
|
|
|
|
int v7 = a2;
|
|
|
|
int v8 = a3;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (a1 < a4) {
|
2013-01-10 07:28:15 +00:00
|
|
|
for (int i = a2; Ligne[a1]._lineDataEndIdx > i; ++i) {
|
2013-01-24 07:04:58 +00:00
|
|
|
route[v8] = Ligne[a1]._lineData[2 * i];
|
|
|
|
route[v8 + 1] = Ligne[a1]._lineData[2 * i + 1];
|
|
|
|
route[v8 + 2] = Ligne[a1].field6;
|
2012-10-02 11:44:23 +00:00
|
|
|
v8 += a7;
|
|
|
|
}
|
2012-11-24 14:32:56 +00:00
|
|
|
|
2013-01-23 23:24:44 +00:00
|
|
|
for (int i = a1 + 1; i < a4; i++) {
|
|
|
|
for (int j = 0; j < Ligne[i]._lineDataEndIdx; j++) {
|
2013-01-24 07:04:58 +00:00
|
|
|
route[v8] = Ligne[i]._lineData[2 * j];
|
|
|
|
route[v8 + 1] = Ligne[i]._lineData[2 * j + 1];
|
|
|
|
route[v8 + 2] = Ligne[i].field6;
|
2012-12-22 00:28:31 +00:00
|
|
|
v8 += a7;
|
2012-11-24 14:32:56 +00:00
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2012-12-22 00:28:31 +00:00
|
|
|
|
2012-10-02 11:44:23 +00:00
|
|
|
v7 = 0;
|
|
|
|
v36 = a4;
|
|
|
|
}
|
|
|
|
if (v36 > a4) {
|
2013-01-23 23:24:44 +00:00
|
|
|
for (int i = v7; i > 0; --i) {
|
2013-01-24 07:04:58 +00:00
|
|
|
route[v8] = Ligne[v36]._lineData[2 * i];
|
|
|
|
route[v8 + 1] = Ligne[v36]._lineData[2 * i + 1];
|
|
|
|
route[v8 + 2] = Ligne[v36].field8;
|
2012-10-02 11:44:23 +00:00
|
|
|
v8 += a7;
|
|
|
|
}
|
2013-01-23 23:24:44 +00:00
|
|
|
for (int i = v36 - 1; i > a4; i--) {
|
|
|
|
for (int j = Ligne[i]._lineDataEndIdx - 1; j > 0; --j) {
|
2013-01-24 07:04:58 +00:00
|
|
|
route[v8] = Ligne[i]._lineData[2 * j];
|
|
|
|
route[v8 + 1] = Ligne[i]._lineData[2 * j + 1];
|
|
|
|
route[v8 + 2] = Ligne[i].field8;
|
2013-01-23 23:05:57 +00:00
|
|
|
v8 += a7;
|
2012-11-24 14:32:56 +00:00
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-10 07:28:15 +00:00
|
|
|
v7 = Ligne[a4]._lineDataEndIdx - 1;
|
2012-10-02 11:44:23 +00:00
|
|
|
v36 = a4;
|
|
|
|
}
|
|
|
|
if (v36 == a4) {
|
|
|
|
if (a5 >= v7) {
|
2013-01-23 23:24:44 +00:00
|
|
|
for (int i = v7; i < a5; i++) {
|
2013-01-24 07:04:58 +00:00
|
|
|
route[v8] = Ligne[a4]._lineData[2 * i];
|
|
|
|
route[v8 + 1] = Ligne[a4]._lineData[2 * i + 1];
|
|
|
|
route[v8 + 2] = Ligne[a4].field6;
|
2012-12-22 00:28:31 +00:00
|
|
|
v8 += a7;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
} else {
|
2012-11-28 09:40:39 +00:00
|
|
|
for (int i = v7; i > a5; --i) {
|
2013-01-24 07:04:58 +00:00
|
|
|
route[v8] = Ligne[a4]._lineData[2 * i];
|
|
|
|
route[v8 + 1] = Ligne[a4]._lineData[2 * i+ 1];
|
|
|
|
route[v8 + 2] = Ligne[a4].field8;
|
2012-10-02 11:44:23 +00:00
|
|
|
v8 += a7;
|
2012-11-23 23:57:37 +00:00
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return v8;
|
|
|
|
}
|
|
|
|
|
2012-10-20 16:59:06 +00:00
|
|
|
// Avoid 1
|
2013-01-24 07:04:58 +00:00
|
|
|
int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7, int a8, int a9) {
|
2012-11-24 14:32:56 +00:00
|
|
|
int v9 = a1;
|
|
|
|
int v10 = a2;
|
|
|
|
int v40 = a3;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (a4 < a1) {
|
2013-01-24 07:04:58 +00:00
|
|
|
for (int i = a2; i < Ligne[a1]._lineDataEndIdx; ++i) {
|
|
|
|
route[v40] = Ligne[a1]._lineData[2 * i];
|
|
|
|
route[v40 + 1] = Ligne[a1]._lineData[2 * i + 1];
|
|
|
|
route[v40 + 2] = Ligne[a1].field6;
|
2012-10-02 11:44:23 +00:00
|
|
|
v40 += a7;
|
|
|
|
}
|
2012-11-24 14:32:56 +00:00
|
|
|
int v15 = a1 + 1;
|
2013-01-24 07:04:58 +00:00
|
|
|
if (v15 == a9 + 1)
|
2012-10-02 11:44:23 +00:00
|
|
|
v15 = a8;
|
|
|
|
while (a4 != v15) {
|
2013-01-24 07:04:58 +00:00
|
|
|
for (int i = 0; i < Ligne[v15]._lineDataEndIdx; i++) {
|
|
|
|
route[v40] = Ligne[v15]._lineData[2 * i];
|
|
|
|
route[v40 + 1] = Ligne[v15]._lineData[2 * i + 1];
|
|
|
|
route[v40 + 2] = Ligne[v15].field6;
|
2012-12-22 00:28:31 +00:00
|
|
|
v40 += a7;
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
++v15;
|
|
|
|
if (a9 + 1 == v15)
|
|
|
|
v15 = a8;
|
|
|
|
}
|
|
|
|
v10 = 0;
|
|
|
|
v9 = a4;
|
|
|
|
}
|
|
|
|
if (a4 > v9) {
|
2013-01-24 07:04:58 +00:00
|
|
|
for (int i = v10; i > 0; --i) {
|
|
|
|
route[v40] = Ligne[v9]._lineData[2 * i];
|
|
|
|
route[v40 + 1] = Ligne[v9]._lineData[2 * i + 1];
|
|
|
|
route[v40 + 2] = Ligne[v9].field8;
|
2012-10-02 11:44:23 +00:00
|
|
|
v40 += a7;
|
|
|
|
}
|
2012-11-24 14:32:56 +00:00
|
|
|
int v24 = v9 - 1;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (v24 == a8 - 1)
|
|
|
|
v24 = a9;
|
|
|
|
while (a4 != v24) {
|
2013-01-24 07:04:58 +00:00
|
|
|
for (int i = Ligne[v24]._lineDataEndIdx - 1; i > 0; --i) {
|
|
|
|
route[v40] = Ligne[v24]._lineData[2 * i];
|
|
|
|
route[v40 + 1] = Ligne[v24]._lineData[2 * i + 1];
|
|
|
|
route[v40 + 2] = Ligne[v24].field8;
|
2012-10-02 11:44:23 +00:00
|
|
|
v40 += a7;
|
|
|
|
}
|
|
|
|
--v24;
|
|
|
|
if (a8 - 1 == v24)
|
|
|
|
v24 = a9;
|
|
|
|
}
|
2013-01-10 07:28:15 +00:00
|
|
|
v10 = Ligne[a4]._lineDataEndIdx - 1;
|
2012-10-02 11:44:23 +00:00
|
|
|
v9 = a4;
|
|
|
|
}
|
|
|
|
if (a4 == v9) {
|
|
|
|
if (a5 >= v10) {
|
2013-01-24 07:04:58 +00:00
|
|
|
for (int i = v10; i < a5; i++) {
|
|
|
|
route[v40] = Ligne[a4]._lineData[2 * i];
|
|
|
|
route[v40 + 1] = Ligne[a4]._lineData[2 * i + 1];
|
|
|
|
route[v40 + 2] = Ligne[a4].field6;
|
|
|
|
v40 += a7;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
} else {
|
2013-01-24 07:04:58 +00:00
|
|
|
for (int i = v10; i > a5; i--) {
|
|
|
|
route[v40] = Ligne[a4]._lineData[2 * i];
|
|
|
|
route[v40 + 1] = Ligne[a4]._lineData[2 * i + 1];
|
|
|
|
route[v40 + 2] = Ligne[a4].field8;
|
2012-10-02 11:44:23 +00:00
|
|
|
v40 += a7;
|
2012-11-24 14:32:56 +00:00
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return v40;
|
|
|
|
}
|
|
|
|
|
2013-01-11 00:50:29 +00:00
|
|
|
bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) {
|
2012-12-14 00:49:22 +00:00
|
|
|
int v5;
|
|
|
|
int v6;
|
|
|
|
int v7;
|
|
|
|
int v8;
|
|
|
|
int v9;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v10;
|
2012-12-14 00:49:22 +00:00
|
|
|
int i;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v12;
|
|
|
|
int v13;
|
2012-12-14 00:49:22 +00:00
|
|
|
int j;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v15;
|
|
|
|
int v16;
|
2012-12-14 00:49:22 +00:00
|
|
|
int k;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v18;
|
|
|
|
int v19;
|
2012-12-14 00:49:22 +00:00
|
|
|
int l;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v21;
|
2012-12-14 00:49:22 +00:00
|
|
|
int v23;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v26;
|
|
|
|
int v29;
|
|
|
|
int v32;
|
2012-12-14 00:49:22 +00:00
|
|
|
int v35 = 0;
|
|
|
|
int v36 = 0;
|
|
|
|
int v37;
|
|
|
|
int v38;
|
|
|
|
int v39;
|
|
|
|
int v40;
|
|
|
|
int v41;
|
|
|
|
int v42 = 0;
|
|
|
|
int v43 = 0;
|
|
|
|
int v44 = 0;
|
|
|
|
int v45 = 0;
|
|
|
|
int v46 = 0;
|
|
|
|
int v47 = 0;
|
|
|
|
int v48 = 0;
|
|
|
|
int v49 = 0;
|
|
|
|
int v50;
|
|
|
|
int v51;
|
2012-10-02 11:44:23 +00:00
|
|
|
|
|
|
|
v5 = a1;
|
|
|
|
v6 = a2;
|
|
|
|
v50 = a3;
|
|
|
|
v7 = a5;
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(a1, a2, &v51, &v50, 0, _linesNumb)) {
|
2012-10-02 11:44:23 +00:00
|
|
|
v8 = Ligne[v50].field4;
|
|
|
|
if (v8 == 1)
|
|
|
|
v6 = a2 - 2;
|
|
|
|
if (v8 == 2) {
|
|
|
|
v6 -= 2;
|
|
|
|
v5 = a1 + 2;
|
|
|
|
}
|
|
|
|
if (v8 == 3)
|
|
|
|
v5 += 2;
|
|
|
|
if (v8 == 4) {
|
|
|
|
v6 += 2;
|
|
|
|
v5 += 2;
|
|
|
|
}
|
|
|
|
if (v8 == 5)
|
|
|
|
v6 += 2;
|
|
|
|
if (v8 == 6) {
|
|
|
|
v6 += 2;
|
|
|
|
v5 -= 2;
|
|
|
|
}
|
|
|
|
if (v8 == 7)
|
|
|
|
v5 -= 2;
|
|
|
|
if (v8 == 8) {
|
|
|
|
v6 -= 2;
|
|
|
|
v5 -= 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
v41 = v5;
|
|
|
|
v40 = v6;
|
|
|
|
v9 = 0;
|
|
|
|
v10 = v40;
|
|
|
|
for (i = v40; v40 + 200 > v10; i = v10) {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(v41, i, &v49, &v48, 0, _vm->_objectsManager._lastLine) == 1 && v48 <= _vm->_objectsManager._lastLine)
|
2012-10-02 11:44:23 +00:00
|
|
|
break;
|
|
|
|
v49 = 0;
|
|
|
|
v48 = -1;
|
|
|
|
++v9;
|
|
|
|
++v10;
|
|
|
|
}
|
|
|
|
v37 = v9;
|
|
|
|
v12 = 0;
|
|
|
|
v13 = v40;
|
|
|
|
for (j = v40; v40 - 200 < v13; j = v13) {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(v41, j, &v47, &v46, 0, _vm->_objectsManager._lastLine) == 1 && v46 <= _vm->_objectsManager._lastLine)
|
2012-10-02 11:44:23 +00:00
|
|
|
break;
|
|
|
|
v47 = 0;
|
|
|
|
v46 = -1;
|
|
|
|
++v12;
|
|
|
|
--v13;
|
|
|
|
}
|
|
|
|
v39 = v12;
|
|
|
|
v15 = 0;
|
|
|
|
v16 = v41;
|
|
|
|
for (k = v41; v41 + 200 > v16; k = v16) {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(k, v40, &v45, &v44, 0, _vm->_objectsManager._lastLine) == 1 && v44 <= _vm->_objectsManager._lastLine)
|
2012-10-02 11:44:23 +00:00
|
|
|
break;
|
|
|
|
v45 = 0;
|
|
|
|
v44 = -1;
|
|
|
|
++v15;
|
|
|
|
++v16;
|
|
|
|
}
|
|
|
|
v38 = v15;
|
|
|
|
v18 = 0;
|
|
|
|
v19 = v41;
|
|
|
|
for (l = v41; v41 - 200 < v19; l = v19) {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(l, v40, &v43, &v42, 0, _vm->_objectsManager._lastLine) == 1 && v42 <= _vm->_objectsManager._lastLine)
|
2012-10-02 11:44:23 +00:00
|
|
|
break;
|
|
|
|
v43 = 0;
|
|
|
|
v42 = -1;
|
|
|
|
++v18;
|
|
|
|
--v19;
|
|
|
|
}
|
|
|
|
if (a4 > v50) {
|
|
|
|
if (v46 != -1 && v46 <= v50)
|
|
|
|
v46 = -1;
|
|
|
|
if (v44 != -1 && v50 >= v44)
|
|
|
|
v44 = -1;
|
|
|
|
if (v48 != -1 && v50 >= v48)
|
|
|
|
v48 = -1;
|
|
|
|
if (v42 != -1 && v50 >= v42)
|
|
|
|
v42 = -1;
|
|
|
|
if (v46 != -1 && a4 < v46)
|
|
|
|
v46 = -1;
|
|
|
|
if (v44 != -1 && a4 < v44)
|
|
|
|
v44 = -1;
|
|
|
|
if (v48 != -1 && a4 < v48)
|
|
|
|
v48 = -1;
|
|
|
|
if (v42 != -1 && a4 < v42)
|
|
|
|
v42 = -1;
|
|
|
|
}
|
|
|
|
if (a4 < v50) {
|
|
|
|
if (v46 != -1 && v46 >= v50)
|
|
|
|
v46 = -1;
|
|
|
|
if (v44 != -1 && v50 <= v44)
|
|
|
|
v44 = -1;
|
|
|
|
if (v48 != -1 && v50 <= v48)
|
|
|
|
v48 = -1;
|
|
|
|
if (v42 != -1 && v50 <= v42)
|
|
|
|
v42 = -1;
|
|
|
|
if (v46 != -1 && a4 > v46)
|
|
|
|
v46 = -1;
|
|
|
|
if (v44 != -1 && a4 > v44)
|
|
|
|
v44 = -1;
|
|
|
|
if (v48 != -1 && a4 > v48)
|
|
|
|
v48 = -1;
|
|
|
|
if (v42 != -1 && a4 > v42)
|
|
|
|
v42 = -1;
|
|
|
|
}
|
|
|
|
if (v46 != -1 || v44 != -1 || v48 != -1 || v42 != -1) {
|
|
|
|
v21 = 0;
|
|
|
|
if (a4 > v50) {
|
|
|
|
if (v48 <= v46 && v44 <= v46 && v42 <= v46 && v46 > v50)
|
|
|
|
v21 = 1;
|
|
|
|
if (v48 <= v44 && v46 <= v44 && v42 <= v44 && v50 < v44)
|
|
|
|
v21 = 3;
|
|
|
|
if (v46 <= v48 && v44 <= v48 && v42 <= v48 && v50 < v48)
|
|
|
|
v21 = 5;
|
|
|
|
if (v48 <= v42 && v44 <= v42 && v46 <= v42 && v50 < v42)
|
|
|
|
v21 = 7;
|
|
|
|
}
|
|
|
|
if (a4 < v50) {
|
|
|
|
if (v46 == -1)
|
|
|
|
v46 = 1300;
|
|
|
|
if (v44 == -1)
|
|
|
|
v44 = 1300;
|
|
|
|
if (v48 == -1)
|
|
|
|
v48 = 1300;
|
|
|
|
if (v42 == -1)
|
|
|
|
v42 = 1300;
|
|
|
|
if (v46 != 1300 && v48 >= v46 && v44 >= v46 && v42 >= v46 && v46 < v50)
|
|
|
|
v21 = 1;
|
|
|
|
if (v44 != 1300 && v48 >= v44 && v46 >= v44 && v42 >= v44 && v50 > v44)
|
|
|
|
v21 = 3;
|
|
|
|
if (v48 != 1300 && v46 >= v48 && v44 >= v48 && v42 >= v48 && v50 > v48)
|
|
|
|
v21 = 5;
|
|
|
|
if (v42 != 1300 && v48 >= v42 && v44 >= v42 && v46 >= v42 && v50 > v42)
|
|
|
|
v21 = 7;
|
|
|
|
}
|
|
|
|
if (v21) {
|
|
|
|
if (v21 == 1) {
|
|
|
|
v36 = v46;
|
|
|
|
v35 = v47;
|
|
|
|
}
|
|
|
|
if (v21 == 3) {
|
|
|
|
v36 = v44;
|
|
|
|
v35 = v45;
|
|
|
|
}
|
|
|
|
if (v21 == 5) {
|
|
|
|
v36 = v48;
|
|
|
|
v35 = v49;
|
|
|
|
}
|
|
|
|
if (v21 == 7) {
|
|
|
|
v36 = v42;
|
|
|
|
v35 = v43;
|
|
|
|
}
|
|
|
|
if (v21 == 1) {
|
2012-12-22 00:28:31 +00:00
|
|
|
for (int v22 = 0; v22 < v39; v22++) {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(v41, v40 - v22, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb)
|
2013-01-01 23:57:00 +00:00
|
|
|
&& _vm->_objectsManager._lastLine < v46) {
|
2012-12-22 00:28:31 +00:00
|
|
|
v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4);
|
|
|
|
if (v23 == -1)
|
2013-01-11 00:50:29 +00:00
|
|
|
return false;
|
2012-12-22 00:28:31 +00:00
|
|
|
v7 = v23;
|
|
|
|
if (NVPY != -1)
|
|
|
|
v22 = NVPY - v40;
|
2012-12-17 23:37:52 +00:00
|
|
|
}
|
2013-01-24 07:04:58 +00:00
|
|
|
_vm->_globals.super_parcours[v7] = v41;
|
|
|
|
_vm->_globals.super_parcours[v7 + 1] = v40 - v22;
|
|
|
|
_vm->_globals.super_parcours[v7 + 2] = 1;
|
|
|
|
_vm->_globals.super_parcours[v7 + 3] = 0;
|
2012-12-22 00:28:31 +00:00
|
|
|
v7 += 4;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
NV_LIGNEDEP = v36;
|
|
|
|
NV_LIGNEOFS = v35;
|
|
|
|
NV_POSI = v7;
|
2013-01-11 00:50:29 +00:00
|
|
|
return true;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
if (v21 == 5) {
|
2012-12-22 00:28:31 +00:00
|
|
|
for (int v25 = 0; v25 < v37; v25++) {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(v41, v25 + v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb)
|
2013-01-01 23:57:00 +00:00
|
|
|
&& _vm->_objectsManager._lastLine < v46) {
|
2012-12-22 00:28:31 +00:00
|
|
|
v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4);
|
|
|
|
if (v26 == -1)
|
2013-01-11 00:50:29 +00:00
|
|
|
return false;
|
2012-12-22 00:28:31 +00:00
|
|
|
v7 = v26;
|
|
|
|
if (NVPY != -1)
|
|
|
|
v25 = v40 - NVPY;
|
2012-12-17 23:37:52 +00:00
|
|
|
}
|
2013-01-24 07:04:58 +00:00
|
|
|
_vm->_globals.super_parcours[v7] = v41;
|
|
|
|
_vm->_globals.super_parcours[v7 + 1] = v25 + v40;
|
|
|
|
_vm->_globals.super_parcours[v7 + 2] = 5;
|
|
|
|
_vm->_globals.super_parcours[v7 + 3] = 0;
|
2012-12-22 00:28:31 +00:00
|
|
|
v7 += 4;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-12 13:50:53 +00:00
|
|
|
NV_LIGNEDEP = v36;
|
|
|
|
NV_LIGNEOFS = v35;
|
|
|
|
NV_POSI = v7;
|
|
|
|
return true;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
if (v21 == 7) {
|
2012-12-22 00:28:31 +00:00
|
|
|
for (int v28 = 0; v28 < v18; v28++) {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(v41 - v28, v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb)
|
2013-01-01 23:57:00 +00:00
|
|
|
&& _vm->_objectsManager._lastLine < v46) {
|
2012-12-22 00:28:31 +00:00
|
|
|
v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4);
|
|
|
|
if (v29 == -1)
|
2013-01-11 00:50:29 +00:00
|
|
|
return false;
|
2012-12-22 00:28:31 +00:00
|
|
|
v7 = v29;
|
|
|
|
if (NVPX != -1)
|
|
|
|
v28 = v41 - NVPX;
|
2012-12-17 23:37:52 +00:00
|
|
|
}
|
2013-01-24 07:04:58 +00:00
|
|
|
_vm->_globals.super_parcours[v7] = v41 - v28;
|
|
|
|
_vm->_globals.super_parcours[v7 + 1] = v40;
|
|
|
|
_vm->_globals.super_parcours[v7 + 2] = 7;
|
|
|
|
_vm->_globals.super_parcours[v7 + 3] = 0;
|
2012-12-22 00:28:31 +00:00
|
|
|
v7 += 4;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-12 13:50:53 +00:00
|
|
|
NV_LIGNEDEP = v36;
|
|
|
|
NV_LIGNEOFS = v35;
|
|
|
|
NV_POSI = v7;
|
|
|
|
return true;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
if (v21 == 3) {
|
2012-12-22 00:28:31 +00:00
|
|
|
for (int v31 = 0; v31 < v38; v31++) {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(v31 + v41, v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb)
|
2013-01-01 23:57:00 +00:00
|
|
|
&& _vm->_objectsManager._lastLine < v46) {
|
2012-12-22 00:28:31 +00:00
|
|
|
v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4);
|
|
|
|
if (v32 == -1)
|
2013-01-11 00:50:29 +00:00
|
|
|
return false;
|
2012-12-22 00:28:31 +00:00
|
|
|
v7 = v32;
|
|
|
|
if (NVPX != -1)
|
|
|
|
v31 = NVPX - v41;
|
2012-12-17 23:37:52 +00:00
|
|
|
}
|
2013-01-24 07:04:58 +00:00
|
|
|
_vm->_globals.super_parcours[v7] = v31 + v41;
|
|
|
|
_vm->_globals.super_parcours[v7 + 1] = v40;
|
|
|
|
_vm->_globals.super_parcours[v7 + 2] = 3;
|
|
|
|
_vm->_globals.super_parcours[v7 + 3] = 0;
|
2012-12-22 00:28:31 +00:00
|
|
|
v7 += 4;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-12 13:50:53 +00:00
|
|
|
NV_LIGNEDEP = v36;
|
|
|
|
NV_LIGNEOFS = v35;
|
|
|
|
NV_POSI = v7;
|
|
|
|
return true;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-11 00:50:29 +00:00
|
|
|
return false;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
|
2013-01-24 07:04:58 +00:00
|
|
|
int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9) {
|
|
|
|
int result = a7;
|
2012-11-24 14:32:56 +00:00
|
|
|
int v80 = -1;
|
2013-01-12 10:55:44 +00:00
|
|
|
++_vm->_globals.pathFindingDepth;
|
|
|
|
if (_vm->_globals.pathFindingDepth > 10) {
|
|
|
|
warning("PathFinding - Max depth reached");
|
2013-01-24 07:04:58 +00:00
|
|
|
route[a7] = -1;
|
|
|
|
route[a7 + 1] = -1;
|
|
|
|
route[a7 + 2] = -1;
|
2012-10-02 11:44:23 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2013-01-10 07:28:15 +00:00
|
|
|
int16 *v10 = Ligne[a1]._lineData;
|
2012-11-24 14:32:56 +00:00
|
|
|
int v98 = v10[0];
|
|
|
|
int v97 = v10[1];
|
|
|
|
int v92 = a1;
|
2012-10-02 11:44:23 +00:00
|
|
|
|
2012-11-24 14:32:56 +00:00
|
|
|
int v65;
|
2012-12-04 20:36:53 +00:00
|
|
|
for (;;) {
|
2012-11-24 14:32:56 +00:00
|
|
|
int v86 = v92 - 1;
|
2013-01-10 07:28:15 +00:00
|
|
|
int v11 = 2 * Ligne[v92 - 1]._lineDataEndIdx;
|
2012-10-19 22:16:25 +00:00
|
|
|
|
2013-01-10 07:28:15 +00:00
|
|
|
int16 *v12 = Ligne[v92 - 1]._lineData;
|
2012-10-19 22:16:25 +00:00
|
|
|
if (v12 == (int16 *)g_PTRNUL)
|
2012-10-02 11:44:23 +00:00
|
|
|
break;
|
2012-10-19 22:16:25 +00:00
|
|
|
while (v12[v11 - 2] != v98 || v97 != v12[v11 - 1]) {
|
2012-10-02 11:44:23 +00:00
|
|
|
--v86;
|
2013-01-01 23:57:00 +00:00
|
|
|
if (_vm->_objectsManager._lastLine - 1 != v86) {
|
2013-01-10 07:28:15 +00:00
|
|
|
v11 = 2 * Ligne[v86]._lineDataEndIdx;
|
|
|
|
v12 = Ligne[v86]._lineData;
|
2012-10-19 22:16:25 +00:00
|
|
|
if (v12 != (int16 *)g_PTRNUL)
|
2012-10-02 11:44:23 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
goto LABEL_11;
|
|
|
|
}
|
2012-10-19 22:16:25 +00:00
|
|
|
|
2012-10-02 11:44:23 +00:00
|
|
|
v92 = v86;
|
2012-10-19 22:16:25 +00:00
|
|
|
v98 = v12[0];
|
|
|
|
v97 = v12[1];
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
LABEL_11:
|
2013-01-10 07:28:15 +00:00
|
|
|
int16 *v13 = Ligne[a1]._lineData;
|
2013-01-12 13:50:53 +00:00
|
|
|
int v95 = v13[2 * Ligne[a1]._lineDataEndIdx - 2];
|
|
|
|
int v93 = v13[2 * Ligne[a1]._lineDataEndIdx - 1];
|
2012-11-24 14:32:56 +00:00
|
|
|
int v91 = a1;
|
|
|
|
int v100, v101;
|
2012-10-19 22:16:25 +00:00
|
|
|
for (;;) {
|
2012-11-24 14:32:56 +00:00
|
|
|
int v87 = v91 + 1;
|
2013-01-10 07:28:15 +00:00
|
|
|
int v15 = 2 * Ligne[v91 + 1]._lineDataEndIdx;
|
|
|
|
int16 *v16 = Ligne[v91 + 1]._lineData;
|
2012-10-19 22:16:25 +00:00
|
|
|
if (v16 == (int16 *)g_PTRNUL)
|
2012-10-02 11:44:23 +00:00
|
|
|
break;
|
2012-11-24 14:32:56 +00:00
|
|
|
int v17;
|
2012-12-04 20:36:53 +00:00
|
|
|
for (;;) {
|
2012-10-02 11:44:23 +00:00
|
|
|
v65 = v15;
|
2012-10-19 22:16:25 +00:00
|
|
|
v17 = v16[v15 - 2];
|
2013-01-24 07:04:58 +00:00
|
|
|
if (v16[0] == v95 && v93 == v16[1])
|
|
|
|
break;
|
|
|
|
|
2012-10-02 11:44:23 +00:00
|
|
|
++v87;
|
2013-01-01 23:57:00 +00:00
|
|
|
if (v87 != _linesNumb + 1) {
|
2013-01-10 07:28:15 +00:00
|
|
|
v15 = 2 * Ligne[v87]._lineDataEndIdx;
|
|
|
|
v16 = Ligne[v87]._lineData;
|
2012-10-19 22:16:25 +00:00
|
|
|
if (v16 != (int16 *)g_PTRNUL)
|
2012-10-02 11:44:23 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
goto LABEL_17;
|
|
|
|
}
|
|
|
|
v91 = v87;
|
|
|
|
v95 = v17;
|
2012-10-19 22:16:25 +00:00
|
|
|
v93 = v16[v65 - 1];
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
LABEL_17:
|
2013-01-12 13:50:53 +00:00
|
|
|
int v58 = abs(a3 - a5) + 1;
|
|
|
|
int v85 = abs(a4 - a6) + 1;
|
|
|
|
int v20 = v85;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (v58 > v20)
|
2013-01-09 07:05:58 +00:00
|
|
|
v85 = v58;
|
2012-11-24 14:32:56 +00:00
|
|
|
int v84 = 1000 * v58 / v85;
|
|
|
|
int v83 = 1000 * v20 / v85;
|
|
|
|
int v21 = 1000 * a3;
|
|
|
|
int v22 = 1000 * a4;
|
2013-01-12 13:50:53 +00:00
|
|
|
int v82 = a3;
|
|
|
|
int v81 = a4;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (a5 < a3)
|
|
|
|
v84 = -v84;
|
|
|
|
if (a6 < a4)
|
|
|
|
v83 = -v83;
|
|
|
|
if (v85 > 800)
|
|
|
|
v85 = 800;
|
2012-10-20 06:06:57 +00:00
|
|
|
|
|
|
|
Common::fill(&_vm->_globals.BufLig[0], &_vm->_globals.BufLig[1000], 0);
|
2013-01-12 10:55:44 +00:00
|
|
|
int bugLigIdx = 0;
|
2013-01-11 00:50:29 +00:00
|
|
|
for (int v88 = 0; v88 < v85 + 1; v88++) {
|
2013-01-12 10:55:44 +00:00
|
|
|
_vm->_globals.BufLig[bugLigIdx] = v82;
|
|
|
|
_vm->_globals.BufLig[bugLigIdx + 1] = v81;
|
2013-01-11 00:50:29 +00:00
|
|
|
v21 += v84;
|
|
|
|
v22 += v83;
|
|
|
|
v82 = v21 / 1000;
|
|
|
|
v81 = v22 / 1000;
|
2013-01-12 10:55:44 +00:00
|
|
|
bugLigIdx += 2;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-12 10:55:44 +00:00
|
|
|
bugLigIdx -= 2;
|
2012-11-24 14:32:56 +00:00
|
|
|
int v77 = 0;
|
|
|
|
int v78 = 0;
|
|
|
|
int v79 = 0;
|
2012-12-22 00:28:31 +00:00
|
|
|
for (int v89 = v85 + 1; v89 > 0; v89--) {
|
2013-01-12 10:55:44 +00:00
|
|
|
if (checkCollisionLine(_vm->_globals.BufLig[bugLigIdx], _vm->_globals.BufLig[bugLigIdx + 1], &v101, &v100, v92, v91) && _vm->_objectsManager._lastLine < v100) {
|
2012-12-22 00:28:31 +00:00
|
|
|
v80 = v100;
|
|
|
|
v77 = v101;
|
2013-01-12 10:55:44 +00:00
|
|
|
v78 = _vm->_globals.BufLig[bugLigIdx];
|
|
|
|
v79 = _vm->_globals.BufLig[bugLigIdx + 1];
|
2012-12-22 00:28:31 +00:00
|
|
|
break;
|
2013-01-12 10:55:44 +00:00
|
|
|
}
|
|
|
|
bugLigIdx -= 2;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2012-11-24 14:32:56 +00:00
|
|
|
int v66 = 0;
|
|
|
|
int v68 = 0;
|
|
|
|
int v70 = 0;
|
|
|
|
int v72 = 0;
|
2013-01-12 10:55:44 +00:00
|
|
|
for (int i = v92; i <= v91; ++i) {
|
|
|
|
int16 *lineData = Ligne[i]._lineData;
|
|
|
|
if (lineData == (int16 *)g_PTRNUL)
|
2012-10-19 22:16:25 +00:00
|
|
|
error("error in genial routine");
|
2012-10-02 11:44:23 +00:00
|
|
|
if (i == v92) {
|
2013-01-12 10:55:44 +00:00
|
|
|
v72 = lineData[2 * Ligne[i]._lineDataEndIdx - 1];
|
|
|
|
if (lineData[1] <= lineData[2 * Ligne[i]._lineDataEndIdx - 1])
|
|
|
|
v72 = lineData[1];
|
|
|
|
v70 = lineData[2 * Ligne[i]._lineDataEndIdx - 1];
|
|
|
|
if (lineData[1] >= lineData[2 * Ligne[i]._lineDataEndIdx - 1])
|
|
|
|
v70 = lineData[1];
|
|
|
|
v68 = lineData[2 * Ligne[i]._lineDataEndIdx - 2];
|
|
|
|
if (lineData[0] <= lineData[2 * Ligne[i]._lineDataEndIdx - 2])
|
|
|
|
v68 = lineData[0];
|
|
|
|
v66 = lineData[2 * Ligne[i]._lineDataEndIdx - 2];
|
|
|
|
if (lineData[0] >= lineData[2 * Ligne[i]._lineDataEndIdx - 2])
|
|
|
|
v66 = lineData[0];
|
2012-10-02 11:44:23 +00:00
|
|
|
} else {
|
2013-01-12 10:55:44 +00:00
|
|
|
if (lineData[1] < lineData[2 * Ligne[i]._lineDataEndIdx - 1] && lineData[1] < v72)
|
|
|
|
v72 = lineData[1];
|
|
|
|
if (lineData[2 * Ligne[i]._lineDataEndIdx - 1] < lineData[1] && lineData[2 * Ligne[i]._lineDataEndIdx - 1] < v72)
|
|
|
|
v72 = lineData[2 * Ligne[i]._lineDataEndIdx - 1];
|
|
|
|
if (lineData[1] > lineData[2 * Ligne[i]._lineDataEndIdx - 1] && lineData[1] > v70)
|
|
|
|
v70 = lineData[1];
|
|
|
|
if (lineData[2 * Ligne[i]._lineDataEndIdx - 1] > lineData[1] && lineData[2 * Ligne[i]._lineDataEndIdx - 1] > v70)
|
|
|
|
v70 = lineData[2 * Ligne[i]._lineDataEndIdx - 1];
|
|
|
|
if (lineData[0] < lineData[2 * Ligne[i]._lineDataEndIdx - 2] && v68 > lineData[0])
|
|
|
|
v68 = lineData[0];
|
|
|
|
if (lineData[2 * Ligne[i]._lineDataEndIdx - 2] < lineData[0] && v68 > lineData[2 * Ligne[i]._lineDataEndIdx - 2])
|
|
|
|
v68 = lineData[2 * Ligne[i]._lineDataEndIdx - 2];
|
|
|
|
if (lineData[0] > lineData[2 * Ligne[i]._lineDataEndIdx - 2] && v66 < lineData[0])
|
|
|
|
v66 = lineData[0];
|
|
|
|
if (lineData[2 * Ligne[i]._lineDataEndIdx - 2] > lineData[0] && v66 < lineData[2 * Ligne[i]._lineDataEndIdx - 2])
|
|
|
|
v66 = lineData[2 * Ligne[i]._lineDataEndIdx - 2];
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
2012-11-24 14:32:56 +00:00
|
|
|
int v69 = v68 - 2;
|
|
|
|
int v73 = v72 - 2;
|
|
|
|
int v67 = v66 + 2;
|
|
|
|
int v71 = v70 + 2;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (a5 >= v69 && a5 <= v67 && a6 >= v73 && a6 <= v71) {
|
2012-11-24 14:32:56 +00:00
|
|
|
int v34 = a6;
|
|
|
|
int v76 = -1;
|
2013-01-12 10:55:44 +00:00
|
|
|
for (;;) {
|
2012-10-02 11:44:23 +00:00
|
|
|
--v34;
|
2013-01-12 10:55:44 +00:00
|
|
|
if (!checkCollisionLine(a5, v34, &v101, &v100, v92, v91))
|
|
|
|
break;
|
|
|
|
|
|
|
|
v76 = v100;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (!v34 || v73 > v34)
|
2013-01-12 10:55:44 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-11-24 14:32:56 +00:00
|
|
|
int v35 = a6;
|
|
|
|
int v75 = -1;
|
2013-01-12 10:55:44 +00:00
|
|
|
for (;;) {
|
2012-10-02 11:44:23 +00:00
|
|
|
++v35;
|
2013-01-12 10:55:44 +00:00
|
|
|
if (!checkCollisionLine(a5, v35, &v101, &v100, v92, v91))
|
|
|
|
break;
|
|
|
|
|
|
|
|
v75 = v100;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (_vm->_globals.Max_Perso_Y <= v35 || v71 <= v35)
|
2013-01-12 10:55:44 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-11-24 14:32:56 +00:00
|
|
|
int v36 = a5;
|
|
|
|
int v74 = -1;
|
2013-01-12 10:55:44 +00:00
|
|
|
for (;;) {
|
2012-10-02 11:44:23 +00:00
|
|
|
++v36;
|
2013-01-12 10:55:44 +00:00
|
|
|
if (!checkCollisionLine(v36, a6, &v101, &v100, v92, v91))
|
|
|
|
break;
|
|
|
|
|
|
|
|
v74 = v100;
|
|
|
|
|
2013-01-20 10:28:39 +00:00
|
|
|
if (_vm->_graphicsManager._maxX <= v36 || v67 <= v36)
|
2013-01-12 10:55:44 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-11-24 14:32:56 +00:00
|
|
|
int v37 = a5;
|
|
|
|
int v38 = -1;
|
2013-01-12 10:55:44 +00:00
|
|
|
for(;;) {
|
2012-10-02 11:44:23 +00:00
|
|
|
--v37;
|
2013-01-12 10:55:44 +00:00
|
|
|
if (!checkCollisionLine(v37, a6, &v101, &v100, v92, v91))
|
|
|
|
break;
|
|
|
|
v38 = v100;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (v37 <= 0 || v69 >= v37)
|
2013-01-12 10:55:44 +00:00
|
|
|
break;;
|
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
if (v74 != -1 && v38 != -1 && v76 != -1 && v75 != -1) {
|
2013-01-24 07:04:58 +00:00
|
|
|
route[a7] = -1;
|
|
|
|
route[a7 + 1] = -1;
|
|
|
|
route[a7 + 2] = -1;
|
2013-01-11 00:50:29 +00:00
|
|
|
return -1;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (v78 < a3 - 1 || v78 > a3 + 1 || v79 < a4 - 1 || v79 > a4 + 1) {
|
2012-10-02 12:41:13 +00:00
|
|
|
NVPX = v78;
|
|
|
|
NVPY = v79;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (a1 < v80) {
|
2012-11-24 14:32:56 +00:00
|
|
|
int v43 = 0;
|
2012-12-17 23:37:52 +00:00
|
|
|
int v42 = a1;
|
2012-10-02 11:44:23 +00:00
|
|
|
do {
|
2013-01-12 10:55:44 +00:00
|
|
|
if (v42 == v92 - 1)
|
2012-10-02 11:44:23 +00:00
|
|
|
v42 = v91;
|
|
|
|
++v43;
|
|
|
|
--v42;
|
2013-01-12 10:55:44 +00:00
|
|
|
if (v42 == v92 - 1)
|
2012-10-02 11:44:23 +00:00
|
|
|
v42 = v91;
|
|
|
|
} while (v80 != v42);
|
2013-01-12 10:55:44 +00:00
|
|
|
if (abs(v80 - a1) == v43) {
|
|
|
|
if (a2 > abs(Ligne[a1]._lineDataEndIdx / 2)) {
|
2013-01-24 07:04:58 +00:00
|
|
|
result = CONTOURNE(a1, a2, a7, v80, v77, route, a9);
|
2012-10-02 11:44:23 +00:00
|
|
|
} else {
|
2013-01-24 07:04:58 +00:00
|
|
|
result = CONTOURNE1(a1, a2, a7, v80, v77, route, a9, v92, v91);
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-12 10:55:44 +00:00
|
|
|
if (abs(v80 - a1) < v43)
|
2013-01-24 07:04:58 +00:00
|
|
|
result = CONTOURNE(a1, a2, result, v80, v77, route, a9);
|
2013-01-12 10:55:44 +00:00
|
|
|
if (v43 < abs(v80 - a1))
|
2013-01-24 07:04:58 +00:00
|
|
|
result = CONTOURNE1(a1, a2, result, v80, v77, route, a9, v92, v91);
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
if (a1 > v80) {
|
2013-01-09 07:05:58 +00:00
|
|
|
int v45 = abs(a1 - v80);
|
2012-11-24 14:32:56 +00:00
|
|
|
int v47 = a1;
|
|
|
|
int v48 = 0;
|
2012-10-02 11:44:23 +00:00
|
|
|
do {
|
2013-01-12 10:55:44 +00:00
|
|
|
if (v47 == v91 + 1)
|
2012-10-02 11:44:23 +00:00
|
|
|
v47 = v92;
|
|
|
|
++v48;
|
|
|
|
++v47;
|
2013-01-12 10:55:44 +00:00
|
|
|
if (v47 == v91 + 1)
|
2012-10-02 11:44:23 +00:00
|
|
|
v47 = v92;
|
|
|
|
} while (v80 != v47);
|
2013-01-12 10:55:44 +00:00
|
|
|
if (v45 == v48) {
|
|
|
|
if (a2 > abs(Ligne[a1]._lineDataEndIdx / 2)) {
|
2013-01-24 07:04:58 +00:00
|
|
|
result = CONTOURNE1(a1, a2, result, v80, v77, route, a9, v92, v91);
|
2012-10-02 11:44:23 +00:00
|
|
|
} else {
|
2013-01-24 07:04:58 +00:00
|
|
|
result = CONTOURNE(a1, a2, result, v80, v77, route, a9);
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-12 10:55:44 +00:00
|
|
|
if (v45 < v48)
|
2013-01-24 07:04:58 +00:00
|
|
|
result = CONTOURNE(a1, a2, result, v80, v77, route, a9);
|
2013-01-12 10:55:44 +00:00
|
|
|
if (v48 < v45)
|
2013-01-24 07:04:58 +00:00
|
|
|
result = CONTOURNE1(a1, a2, result, v80, v77, route, a9, v92, v91);
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
if (a1 == v80)
|
2013-01-24 07:04:58 +00:00
|
|
|
result = CONTOURNE(a1, a2, result, a1, v77, route, a9);
|
2013-01-12 10:55:44 +00:00
|
|
|
for(;;) {
|
|
|
|
if (!checkCollisionLine(NVPX, NVPY, &v101, &v100, _vm->_objectsManager._lastLine + 1, _linesNumb))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (Ligne[v100].field4 == 1)
|
|
|
|
--NVPY;
|
|
|
|
if (Ligne[v100].field4 == 2) {
|
|
|
|
--NVPY;
|
|
|
|
++NVPX;
|
|
|
|
}
|
|
|
|
if (Ligne[v100].field4 == 3)
|
|
|
|
++NVPX;
|
|
|
|
if (Ligne[v100].field4 == 4) {
|
|
|
|
++NVPY;
|
|
|
|
++NVPX;
|
|
|
|
}
|
|
|
|
if (Ligne[v100].field4 == 5)
|
|
|
|
++NVPY;
|
|
|
|
if (Ligne[v100].field4 == 6) {
|
|
|
|
++NVPY;
|
|
|
|
--NVPX;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-12 10:55:44 +00:00
|
|
|
if (Ligne[v100].field4 == 7)
|
|
|
|
--NVPX;
|
|
|
|
if (Ligne[v100].field4 == 8) {
|
|
|
|
--NVPY;
|
|
|
|
--NVPX;
|
|
|
|
}
|
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
} else {
|
2012-10-02 12:41:13 +00:00
|
|
|
NVPX = -1;
|
|
|
|
NVPY = -1;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 07:04:58 +00:00
|
|
|
return result;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
|
2012-10-20 16:59:06 +00:00
|
|
|
// Avoid 2
|
2012-11-18 02:14:18 +00:00
|
|
|
int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) {
|
2012-11-18 00:48:28 +00:00
|
|
|
int v14;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v55;
|
|
|
|
int v58;
|
2012-11-18 00:48:28 +00:00
|
|
|
int v61;
|
|
|
|
int v64;
|
2012-10-02 11:44:23 +00:00
|
|
|
int v67;
|
2012-11-18 00:48:28 +00:00
|
|
|
int v72;
|
2012-12-14 00:49:22 +00:00
|
|
|
int v78;
|
|
|
|
int v79;
|
|
|
|
int v88;
|
|
|
|
int v89;
|
|
|
|
int v110;
|
|
|
|
int v112;
|
2013-01-02 19:12:32 +00:00
|
|
|
int v118 = 0;
|
|
|
|
int v119 = 0;
|
2012-12-14 00:49:22 +00:00
|
|
|
int v124;
|
|
|
|
int v125;
|
2012-11-18 00:48:28 +00:00
|
|
|
int v126[9];
|
|
|
|
int v131[9];
|
|
|
|
int v136[9];
|
|
|
|
int v141[9];
|
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
int clipDestX = destX;
|
|
|
|
int clipDestY = destY;
|
|
|
|
int v121 = 0;
|
|
|
|
int v120 = 0;
|
|
|
|
int v115 = 0;
|
|
|
|
int v114 = 0;
|
|
|
|
int v113 = 0;
|
|
|
|
int v111 = 0;
|
2012-10-22 11:31:46 +00:00
|
|
|
if (destY <= 24)
|
2013-01-12 10:55:44 +00:00
|
|
|
clipDestY = 25;
|
2012-10-02 11:44:23 +00:00
|
|
|
if (!_vm->_globals.NOT_VERIF) {
|
2013-01-12 10:55:44 +00:00
|
|
|
if (abs(srcX - _vm->_globals.old_x1_65) <= 4 && abs(srcY - _vm->_globals.old_y1_66) <= 4 &&
|
|
|
|
abs(_vm->_globals.old_x2_67 - destX) <= 4 && abs(_vm->_globals.old_y2_68 - clipDestY) <= 4)
|
|
|
|
return (int16 *)g_PTRNUL;
|
|
|
|
|
|
|
|
if (abs(srcX - destX) <= 4 && abs(srcY - clipDestY) <= 4)
|
|
|
|
return (int16 *)g_PTRNUL;
|
|
|
|
|
|
|
|
if (_vm->_globals._oldZoneNum > 0 && _vm->_objectsManager._zoneNum > 0 && _vm->_globals._oldZoneNum == _vm->_objectsManager._zoneNum)
|
2012-10-20 06:47:57 +00:00
|
|
|
return (int16 *)g_PTRNUL;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-01 23:57:00 +00:00
|
|
|
_vm->_globals.NOT_VERIF = false;
|
2013-01-12 10:55:44 +00:00
|
|
|
_vm->_globals._oldZoneNum = _vm->_objectsManager._zoneNum;
|
2012-11-18 02:14:18 +00:00
|
|
|
_vm->_globals.old_x1_65 = srcX;
|
2012-10-22 11:31:46 +00:00
|
|
|
_vm->_globals.old_x2_67 = destX;
|
2012-11-18 02:14:18 +00:00
|
|
|
_vm->_globals.old_y1_66 = srcY;
|
2013-01-12 10:55:44 +00:00
|
|
|
_vm->_globals.old_y2_68 = clipDestY;
|
|
|
|
_vm->_globals.pathFindingDepth = 0;
|
2012-10-02 11:44:23 +00:00
|
|
|
v112 = 0;
|
2012-10-22 11:31:46 +00:00
|
|
|
if (destX <= 19)
|
2013-01-12 10:55:44 +00:00
|
|
|
clipDestX = 20;
|
|
|
|
if (clipDestY <= 19)
|
|
|
|
clipDestY = 20;
|
2013-01-20 10:28:39 +00:00
|
|
|
if (clipDestX > _vm->_graphicsManager._maxX - 10)
|
|
|
|
clipDestX = _vm->_graphicsManager._maxX - 10;
|
2013-01-12 10:55:44 +00:00
|
|
|
if (clipDestY > _vm->_globals.Max_Perso_Y)
|
|
|
|
clipDestY = _vm->_globals.Max_Perso_Y;
|
|
|
|
|
|
|
|
if (abs(srcX - clipDestX) <= 3 && abs(srcY - clipDestY) <= 3)
|
|
|
|
return (int16 *)g_PTRNUL;
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
for (int i = 0; i <= 8; ++i) {
|
|
|
|
v141[i] = -1;
|
|
|
|
v136[i] = 0;
|
|
|
|
v131[i] = 1300;
|
|
|
|
v126[i] = 1300;
|
2012-10-17 10:08:19 +00:00
|
|
|
}
|
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
if (PARC_PERS(srcX, srcY, clipDestX, clipDestY, -1, -1, 0) == 1)
|
|
|
|
return &_vm->_globals.super_parcours[0];
|
2013-01-24 07:34:35 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
v14 = 0;
|
|
|
|
for (int tmpY = clipDestY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) {
|
|
|
|
if (checkCollisionLine(clipDestX, tmpY, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine)
|
|
|
|
break;
|
|
|
|
v136[5] = 0;
|
|
|
|
v141[5] = -1;
|
|
|
|
}
|
|
|
|
v131[5] = v14;
|
2013-01-24 07:34:35 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
v14 = 0;
|
|
|
|
for (int tmpY = clipDestY; tmpY > _vm->_graphicsManager._minY; tmpY--, v14++) {
|
|
|
|
if (checkCollisionLine(clipDestX, tmpY, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine)
|
|
|
|
break;
|
|
|
|
v136[1] = 0;
|
|
|
|
v141[1] = -1;
|
|
|
|
if (v131[5] < v14 && v141[5] != -1)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
v131[1] = v14;
|
2013-01-24 07:34:35 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
v14 = 0;
|
|
|
|
for (int tmpX = clipDestX; tmpX < _vm->_graphicsManager._maxX; tmpX++) {
|
|
|
|
if (checkCollisionLine(tmpX, clipDestY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine)
|
|
|
|
break;
|
|
|
|
v136[3] = 0;
|
|
|
|
v141[3] = -1;
|
|
|
|
++v14;
|
|
|
|
if (v131[1] < v14 && v141[1] != -1)
|
2013-01-24 07:34:35 +00:00
|
|
|
break;
|
2013-01-24 19:50:48 +00:00
|
|
|
if (v131[5] < v14 && v141[5] != -1)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
v131[3] = v14;
|
2013-01-24 07:34:35 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
v14 = 0;
|
|
|
|
for (int tmpX = clipDestX; tmpX > _vm->_graphicsManager._minX; tmpX--) {
|
|
|
|
if (checkCollisionLine(tmpX, clipDestY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine)
|
|
|
|
break;
|
|
|
|
v136[7] = 0;
|
|
|
|
v141[7] = -1;
|
|
|
|
++v14;
|
|
|
|
if (v131[1] < v14 && v141[1] != -1)
|
|
|
|
break;
|
|
|
|
if (v131[5] < v14 && v141[5] != -1)
|
|
|
|
break;
|
|
|
|
if (v131[3] < v14 && v141[3] != -1)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
v131[7] = v14;
|
|
|
|
|
|
|
|
if (v141[1] < 0 || _vm->_objectsManager._lastLine < v141[1])
|
|
|
|
v141[1] = -1;
|
|
|
|
if (v141[3] < 0 || _vm->_objectsManager._lastLine < v141[3])
|
|
|
|
v141[3] = -1;
|
|
|
|
if (v141[5] < 0 || _vm->_objectsManager._lastLine < v141[5])
|
|
|
|
v141[5] = -1;
|
|
|
|
if (v141[7] < 0 || _vm->_objectsManager._lastLine < v141[7])
|
|
|
|
v141[7] = -1;
|
|
|
|
if (v141[1] < 0)
|
|
|
|
v131[1] = 1300;
|
|
|
|
if (v141[3] < 0)
|
|
|
|
v131[3] = 1300;
|
|
|
|
if (v141[5] < 0)
|
|
|
|
v131[5] = 1300;
|
|
|
|
if (v141[7] < 0)
|
|
|
|
v131[7] = 1300;
|
|
|
|
if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1)
|
|
|
|
return (int16 *)g_PTRNUL;
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
if (v141[5] != -1 && v131[1] >= v131[5] && v131[3] >= v131[5] && v131[7] >= v131[5]) {
|
|
|
|
v121 = v141[5];
|
|
|
|
v120 = v136[5];
|
|
|
|
} else if (v141[1] != -1 && v131[5] >= v131[1] && v131[3] >= v131[1] && v131[7] >= v131[1]) {
|
|
|
|
v121 = v141[1];
|
|
|
|
v120 = v136[1];
|
|
|
|
} else if (v141[3] != -1 && v131[1] >= v131[3] && v131[5] >= v131[3] && v131[7] >= v131[3]) {
|
|
|
|
v121 = v141[3];
|
|
|
|
v120 = v136[3];
|
|
|
|
} else if (v141[7] != -1 && v131[5] >= v131[7] && v131[3] >= v131[7] && v131[1] >= v131[7]) {
|
|
|
|
v121 = v141[7];
|
|
|
|
v120 = v136[7];
|
|
|
|
}
|
2012-10-17 10:08:19 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
for (int i = 0; i <= 8; ++i) {
|
|
|
|
v141[i] = -1;
|
|
|
|
v136[i] = 0;
|
|
|
|
v131[i] = 1300;
|
|
|
|
v126[i] = 1300;
|
|
|
|
}
|
2013-01-24 07:34:35 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
v14 = 0;
|
|
|
|
for (int tmpY = srcY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) {
|
|
|
|
if (checkCollisionLine(srcX, tmpY, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine)
|
|
|
|
break;
|
|
|
|
v136[5] = 0;
|
|
|
|
v141[5] = -1;
|
|
|
|
}
|
|
|
|
v131[5] = v14 + 1;
|
2013-01-24 07:34:35 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
v14 = 0;
|
|
|
|
for (int tmpY = srcY; tmpY > _vm->_graphicsManager._minY; tmpY--) {
|
|
|
|
if (checkCollisionLine(srcX, tmpY, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine)
|
|
|
|
break;
|
|
|
|
v136[1] = 0;
|
|
|
|
v141[1] = -1;
|
|
|
|
++v14;
|
|
|
|
if (v141[5] != -1 && v14 > 80)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
v131[1] = v14 + 1;
|
2013-01-24 07:34:35 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
v14 = 0;
|
|
|
|
for (int tmpX = srcX; tmpX < _vm->_graphicsManager._maxX; tmpX++) {
|
|
|
|
if (checkCollisionLine(tmpX, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine)
|
|
|
|
break;
|
|
|
|
v136[3] = 0;
|
|
|
|
v141[3] = -1;
|
|
|
|
++v14;
|
|
|
|
if ((v141[5] != -1 || v141[1] != -1) && (v14 > 100))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
v131[3] = v14 + 1;
|
|
|
|
|
|
|
|
v14 = 0;
|
|
|
|
for (int tmpX = srcX; tmpX > _vm->_graphicsManager._minX; tmpX--) {
|
|
|
|
if (checkCollisionLine(tmpX, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine)
|
|
|
|
break;
|
|
|
|
v136[7] = 0;
|
|
|
|
v141[7] = -1;
|
|
|
|
++v14;
|
|
|
|
if ((v141[5] != -1 || v141[1] != -1 || v141[3] != -1) && (v14 > 100))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
v131[7] = v14 + 1;
|
|
|
|
|
|
|
|
if (v141[1] != -1)
|
|
|
|
v126[1] = abs(v141[1] - v121);
|
|
|
|
|
|
|
|
if (v141[3] != -1)
|
|
|
|
v126[3] = abs(v141[3] - v121);
|
|
|
|
|
|
|
|
if (v141[5] != -1)
|
|
|
|
v126[5] = abs(v141[5] - v121);
|
|
|
|
|
|
|
|
if (v141[7] != -1)
|
|
|
|
v126[7] = abs(v141[7] - v121);
|
|
|
|
|
|
|
|
if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1)
|
|
|
|
error("Nearest point not found");
|
|
|
|
|
|
|
|
if (v141[1] != -1 && v126[3] >= v126[1] && v126[5] >= v126[1] && v126[7] >= v126[1]) {
|
|
|
|
v115 = v141[1];
|
|
|
|
v111 = v131[1];
|
|
|
|
v113 = 1;
|
|
|
|
v114 = v136[1];
|
|
|
|
} else if (v141[5] != -1 && v126[3] >= v126[5] && v126[1] >= v126[5] && v126[7] >= v126[5]) {
|
|
|
|
v115 = v141[5];
|
|
|
|
v111 = v131[5];
|
|
|
|
v113 = 5;
|
|
|
|
v114 = v136[5];
|
|
|
|
} else if (v141[3] != -1 && v126[1] >= v126[3] && v126[5] >= v126[3] && v126[7] >= v126[3]) {
|
|
|
|
v115 = v141[3];
|
|
|
|
v111 = v131[3];
|
|
|
|
v113 = 3;
|
|
|
|
v114 = v136[3];
|
|
|
|
} else if (v141[7] != -1 && v126[1] >= v126[7] && v126[5] >= v126[7] && v126[3] >= v126[7]) {
|
|
|
|
v115 = v141[7];
|
|
|
|
v111 = v131[7];
|
|
|
|
v113 = 7;
|
|
|
|
v114 = v136[7];
|
|
|
|
}
|
2013-01-24 07:34:35 +00:00
|
|
|
|
2013-01-24 19:50:48 +00:00
|
|
|
v55 = PARC_PERS(srcX, srcY, clipDestX, clipDestY, v115, v121, 0);
|
|
|
|
if (v55 != 1) {
|
|
|
|
if (v55 == 2) {
|
2012-10-02 11:44:23 +00:00
|
|
|
LABEL_201:
|
2013-01-24 19:50:48 +00:00
|
|
|
v115 = NV_LIGNEDEP;
|
|
|
|
v114 = NV_LIGNEOFS;
|
|
|
|
v112 = NV_POSI;
|
|
|
|
} else {
|
|
|
|
if (v113 == 1) {
|
|
|
|
for (int deltaY = 0; deltaY < v111; deltaY++) {
|
|
|
|
if (checkCollisionLine(srcX, srcY - deltaY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb)
|
|
|
|
&& _vm->_objectsManager._lastLine < v124) {
|
|
|
|
v58 = GENIAL(v124, v125, srcX, srcY - deltaY, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4);
|
|
|
|
if (v58 == -1) {
|
|
|
|
_vm->_globals.super_parcours[v112] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = -1;
|
|
|
|
return &_vm->_globals.super_parcours[0];
|
|
|
|
}
|
|
|
|
v112 = v58;
|
|
|
|
if (NVPY != -1)
|
|
|
|
deltaY = srcY - NVPY;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
_vm->_globals.super_parcours[v112] = srcX;
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = srcY - deltaY;
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = 1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = 0;
|
|
|
|
v112 += 4;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
} else if (v113 == 5) {
|
|
|
|
for (int deltaY = 0; deltaY < v111; deltaY++) {
|
|
|
|
if (checkCollisionLine(srcX, deltaY + srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb)
|
|
|
|
&& _vm->_objectsManager._lastLine < v124) {
|
|
|
|
v61 = GENIAL(v124, v125, srcX, deltaY + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4);
|
|
|
|
if (v61 == -1) {
|
|
|
|
_vm->_globals.super_parcours[v112] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = -1;
|
|
|
|
return &_vm->_globals.super_parcours[0];
|
|
|
|
}
|
|
|
|
v112 = v61;
|
|
|
|
if (NVPY != -1)
|
|
|
|
deltaY = NVPY - srcY;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
_vm->_globals.super_parcours[v112] = srcX;
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = deltaY + srcY;
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = 5;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = 0;
|
|
|
|
v112 += 4;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
} else if (v113 == 7) {
|
|
|
|
for (int deltaX = 0; deltaX < v111; deltaX++) {
|
|
|
|
if (checkCollisionLine(srcX - deltaX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb)
|
|
|
|
&& _vm->_objectsManager._lastLine < v124) {
|
|
|
|
v64 = GENIAL(v124, v125, srcX - deltaX, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4);
|
|
|
|
if (v64 == -1) {
|
|
|
|
_vm->_globals.super_parcours[v112] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = -1;
|
|
|
|
return &_vm->_globals.super_parcours[0];
|
|
|
|
}
|
|
|
|
v112 = v64;
|
|
|
|
if (NVPX != -1)
|
|
|
|
deltaX = srcX - NVPX;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
_vm->_globals.super_parcours[v112] = srcX - deltaX;
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = srcY;
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = 7;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = 0;
|
|
|
|
v112 += 4;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
} else if (v113 == 3) {
|
|
|
|
for (int deltaX = 0; deltaX < v111; deltaX++) {
|
|
|
|
if (checkCollisionLine(deltaX + srcX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb)
|
|
|
|
&& _vm->_objectsManager._lastLine < v124) {
|
|
|
|
v67 = GENIAL(v124, v125, deltaX + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4);
|
|
|
|
if (v67 == -1) {
|
|
|
|
_vm->_globals.super_parcours[v112] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = -1;
|
|
|
|
return &_vm->_globals.super_parcours[0];
|
|
|
|
}
|
|
|
|
v112 = v67;
|
|
|
|
if (NVPX != -1)
|
|
|
|
deltaX = NVPX - srcX;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
_vm->_globals.super_parcours[v112] = deltaX + srcX;
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = srcY;
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = 3;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = 0;
|
|
|
|
v112 += 4;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
LABEL_234:
|
2013-01-24 19:50:48 +00:00
|
|
|
if (v115 < v121) {
|
|
|
|
for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) {
|
|
|
|
_vm->_globals.super_parcours[v112] = Ligne[v115]._lineData[2 * i];
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * i + 1];
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = Ligne[v115].field6;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = 0;
|
|
|
|
v112 += 4;
|
|
|
|
}
|
|
|
|
for (int v116 = v115 + 1; v116 < v121; v116++) {
|
|
|
|
v72 = 0;
|
|
|
|
v110 = v116;
|
|
|
|
for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) {
|
|
|
|
v119 = Ligne[v110]._lineData[2 * v72];
|
|
|
|
v118 = Ligne[v110]._lineData[2 * v72 + 1];
|
|
|
|
_vm->_globals.super_parcours[v112] = v119;
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = v118;
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = Ligne[v110].field6;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = 0;
|
2012-10-02 11:44:23 +00:00
|
|
|
v112 += 4;
|
2013-01-24 19:50:48 +00:00
|
|
|
if (Ligne[v110]._lineDataEndIdx > 30) {
|
|
|
|
if (v72 == Ligne[v110]._lineDataEndIdx / 2) {
|
|
|
|
v78 = PARC_PERS(v119, v118, clipDestX, clipDestY, v110, v121, v112);
|
|
|
|
if (v78 == 1)
|
|
|
|
return &_vm->_globals.super_parcours[0];
|
|
|
|
if (v78 == 2) {
|
|
|
|
v115 = NV_LIGNEDEP;
|
|
|
|
v114 = NV_LIGNEOFS;
|
|
|
|
v112 = NV_POSI;
|
|
|
|
goto LABEL_234;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
if (MIRACLE(v119, v118, v110, v121, v112))
|
|
|
|
goto LABEL_201;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
}
|
|
|
|
++v72;
|
|
|
|
v110 = v116;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112);
|
|
|
|
if (v79 == 1)
|
|
|
|
return &_vm->_globals.super_parcours[0];
|
|
|
|
if (v79 == 2) {
|
|
|
|
v115 = NV_LIGNEDEP;
|
|
|
|
v114 = NV_LIGNEOFS;
|
|
|
|
v112 = NV_POSI;
|
|
|
|
goto LABEL_234;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
if (MIRACLE(v119, v118, v116, v121, v112))
|
|
|
|
goto LABEL_201;
|
|
|
|
}
|
|
|
|
v114 = 0;
|
|
|
|
v115 = v121;
|
|
|
|
}
|
|
|
|
if (v115 > v121) {
|
|
|
|
for (int dataIdx = v114; dataIdx > 0; dataIdx--) {
|
|
|
|
_vm->_globals.super_parcours[v112] = Ligne[v115]._lineData[2 * dataIdx];
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * dataIdx + 1];
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = Ligne[v115].field8;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = 0;
|
|
|
|
v112 += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int v117 = v115 - 1; v117 > v121; v117--) {
|
|
|
|
for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) {
|
|
|
|
_vm->_globals.super_parcours[v112] = Ligne[v117]._lineData[2 * dataIdx];
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = Ligne[v117]._lineData[2 * dataIdx + 1];
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = Ligne[v117].field8;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = 0;
|
|
|
|
v112 += 4;
|
|
|
|
if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) {
|
|
|
|
v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112);
|
|
|
|
if (v88 == 1)
|
2012-10-20 06:47:57 +00:00
|
|
|
return &_vm->_globals.super_parcours[0];
|
2013-01-24 19:50:48 +00:00
|
|
|
if (v88 == 2) {
|
2013-01-12 13:50:53 +00:00
|
|
|
v115 = NV_LIGNEDEP;
|
|
|
|
v114 = NV_LIGNEOFS;
|
|
|
|
v112 = NV_POSI;
|
2013-01-24 19:50:48 +00:00
|
|
|
goto LABEL_234;
|
2013-01-12 13:50:53 +00:00
|
|
|
}
|
2013-01-11 00:50:29 +00:00
|
|
|
if (MIRACLE(v119, v118, v117, v121, v112))
|
2012-10-02 11:44:23 +00:00
|
|
|
goto LABEL_201;
|
|
|
|
}
|
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112);
|
|
|
|
if (v89 == 1)
|
|
|
|
return &_vm->_globals.super_parcours[0];
|
|
|
|
if (v89 == 2) {
|
|
|
|
v115 = NV_LIGNEDEP;
|
|
|
|
v114 = NV_LIGNEOFS;
|
|
|
|
v112 = NV_POSI;
|
|
|
|
goto LABEL_234;
|
|
|
|
}
|
|
|
|
if (MIRACLE(v119, v118, v117, v121, v112))
|
|
|
|
goto LABEL_201;
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
v114 = Ligne[v121]._lineDataEndIdx - 1;
|
|
|
|
v115 = v121;
|
|
|
|
}
|
|
|
|
if (v115 == v121) {
|
|
|
|
if (v114 <= v120) {
|
|
|
|
for (int dataIdx = v114; dataIdx < v120; dataIdx++) {
|
|
|
|
_vm->_globals.super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx];
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1];
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = Ligne[v121].field6;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = 0;
|
|
|
|
v112 += 4;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (int dataIdx = v114; dataIdx > v120; dataIdx--) {
|
|
|
|
_vm->_globals.super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx];
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1];
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = Ligne[v121].field8;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = 0;
|
|
|
|
v112 += 4;
|
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-24 19:50:48 +00:00
|
|
|
if (PARC_PERS(_vm->_globals.super_parcours[v112 - 4],
|
|
|
|
_vm->_globals.super_parcours[v112 - 3],
|
|
|
|
clipDestX,
|
|
|
|
clipDestY,
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
v112) != 1) {
|
|
|
|
_vm->_globals.super_parcours[v112] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 1] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 2] = -1;
|
|
|
|
_vm->_globals.super_parcours[v112 + 3] = -1;
|
|
|
|
}
|
|
|
|
return &_vm->_globals.super_parcours[0];
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
2012-10-20 06:47:57 +00:00
|
|
|
return &_vm->_globals.super_parcours[0];
|
2012-10-02 11:44:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) {
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v17;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v18;
|
|
|
|
int v19;
|
|
|
|
int v20;
|
|
|
|
int v21;
|
|
|
|
int v22;
|
|
|
|
int v23;
|
|
|
|
int v24;
|
|
|
|
int v25;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v26;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v27;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v28;
|
|
|
|
int16 *v29;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v30;
|
|
|
|
int v31;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v32;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v33;
|
|
|
|
int v34;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v35;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v36;
|
|
|
|
int v37;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v38;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v39;
|
|
|
|
int v40;
|
|
|
|
int v41;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v42;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v43;
|
|
|
|
int v44;
|
2012-12-30 23:18:08 +00:00
|
|
|
bool v45;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v46;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v47;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v48;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v49;
|
|
|
|
int16 *v50;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v51;
|
|
|
|
int v52;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v53;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v54;
|
|
|
|
int v55;
|
|
|
|
int v56;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v57;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v58;
|
|
|
|
int v59;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v60;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v61;
|
|
|
|
int v62;
|
|
|
|
int v63;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v64;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v65;
|
|
|
|
int v66;
|
2012-10-19 11:19:50 +00:00
|
|
|
int16 *v72;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v73;
|
|
|
|
int v74;
|
|
|
|
int v76;
|
2012-12-14 00:49:22 +00:00
|
|
|
int16 *v77;
|
|
|
|
int16 *v78;
|
|
|
|
int v79;
|
|
|
|
int16 *v80;
|
|
|
|
int v81;
|
|
|
|
int16 *v82;
|
|
|
|
int v83;
|
|
|
|
int16 *v84;
|
|
|
|
int v85;
|
|
|
|
int16 *v86;
|
|
|
|
int v87;
|
|
|
|
int16 *v88;
|
|
|
|
int v89;
|
|
|
|
int v91;
|
|
|
|
int v92;
|
|
|
|
int v93;
|
|
|
|
int v94;
|
|
|
|
int v95;
|
|
|
|
int v96;
|
|
|
|
int v97;
|
|
|
|
int v98;
|
|
|
|
int v99;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v100;
|
|
|
|
int v101;
|
|
|
|
int v102;
|
|
|
|
int v103;
|
|
|
|
int v104;
|
|
|
|
int v105;
|
|
|
|
int v106;
|
|
|
|
int v107;
|
|
|
|
int v108;
|
|
|
|
int v109;
|
|
|
|
int v110;
|
|
|
|
int v111;
|
|
|
|
int v113;
|
|
|
|
int v114;
|
|
|
|
int v115;
|
|
|
|
int v116;
|
|
|
|
int v117;
|
|
|
|
int v118;
|
|
|
|
int v119;
|
|
|
|
int v120;
|
|
|
|
int v121;
|
|
|
|
int v122;
|
|
|
|
int v123;
|
|
|
|
int v124;
|
|
|
|
int v125;
|
2012-10-03 12:15:39 +00:00
|
|
|
int v126 = 0;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v127;
|
|
|
|
int v128;
|
|
|
|
int v129;
|
|
|
|
int v130;
|
|
|
|
int v131;
|
|
|
|
int v132;
|
|
|
|
int v133;
|
|
|
|
int v134;
|
|
|
|
int v135;
|
|
|
|
int v138;
|
|
|
|
int v139;
|
2012-12-14 00:49:22 +00:00
|
|
|
int v140;
|
|
|
|
int v141;
|
|
|
|
int v142;
|
|
|
|
int v143;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v145;
|
2012-12-30 23:18:08 +00:00
|
|
|
bool colResult = false;
|
2012-10-02 12:41:13 +00:00
|
|
|
|
2012-11-24 14:32:56 +00:00
|
|
|
int v7 = a1;
|
2013-01-12 10:55:44 +00:00
|
|
|
int v90 = a2;
|
|
|
|
int v137 = a7;
|
|
|
|
int v136 = 0;
|
2012-10-02 12:41:13 +00:00
|
|
|
if (a5 == -1 && a6 == -1)
|
|
|
|
v136 = 1;
|
2013-01-12 10:55:44 +00:00
|
|
|
int v144 = a5;
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(a1, a2, &v145, &v144, 0, _linesNumb)) {
|
2013-01-12 10:55:44 +00:00
|
|
|
switch (Ligne[v144].field4) {
|
|
|
|
case 1:
|
|
|
|
v90 -= 2;
|
|
|
|
break;
|
|
|
|
case 2:
|
2012-10-02 12:41:13 +00:00
|
|
|
v90 -= 2;
|
|
|
|
v7 += 2;
|
2013-01-12 10:55:44 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
v7 += 2;
|
|
|
|
break;
|
|
|
|
case 4:
|
2012-10-02 12:41:13 +00:00
|
|
|
v90 += 2;
|
|
|
|
v7 += 2;
|
2013-01-12 10:55:44 +00:00
|
|
|
case 5:
|
2012-10-02 12:41:13 +00:00
|
|
|
v90 += 2;
|
2013-01-12 10:55:44 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2012-10-02 12:41:13 +00:00
|
|
|
v90 += 2;
|
|
|
|
v7 -= 2;
|
2013-01-12 10:55:44 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2012-10-02 12:41:13 +00:00
|
|
|
v7 -= 2;
|
2013-01-12 10:55:44 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
2012-10-02 12:41:13 +00:00
|
|
|
v90 -= 2;
|
|
|
|
v7 -= 2;
|
2013-01-12 10:55:44 +00:00
|
|
|
break;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
v98 = v7;
|
|
|
|
v97 = v90;
|
|
|
|
v115 = 0;
|
|
|
|
v142 = -1;
|
|
|
|
v140 = -1;
|
|
|
|
v138 = -1;
|
2012-10-21 11:25:05 +00:00
|
|
|
|
2012-11-24 14:32:56 +00:00
|
|
|
int v9, v10, v11, v12, v13, v14;
|
2012-10-21 11:25:05 +00:00
|
|
|
for (;;) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v111 = v7;
|
|
|
|
v109 = v90;
|
|
|
|
if (a3 >= v7 - 2 && a3 <= v7 + 2 && a4 >= v90 - 2 && a4 <= v90 + 2) {
|
|
|
|
LABEL_149:
|
|
|
|
v27 = v115;
|
|
|
|
v28 = _vm->_globals.essai0;
|
2012-10-19 11:19:50 +00:00
|
|
|
v28[v27] = -1;
|
|
|
|
v28[v27 + 1] = -1;
|
|
|
|
v28[v27 + 2] = -1;
|
|
|
|
|
2012-10-02 12:41:13 +00:00
|
|
|
LABEL_150:
|
|
|
|
if (v115) {
|
|
|
|
v127 = 0;
|
|
|
|
v116 = 0;
|
|
|
|
v29 = _vm->_globals.essai0;
|
|
|
|
do {
|
|
|
|
v30 = v137;
|
2012-10-19 11:19:50 +00:00
|
|
|
_vm->_globals.super_parcours[v30] = v29[v116];
|
|
|
|
_vm->_globals.super_parcours[v30 + 1] = v29[v116 + 1];
|
|
|
|
_vm->_globals.super_parcours[v30 + 2] = v29[v116 + 2];
|
2012-10-02 12:41:13 +00:00
|
|
|
_vm->_globals.super_parcours[v30 + 3] = 0;
|
|
|
|
v116 += 3;
|
|
|
|
v137 += 4;
|
2012-10-19 11:19:50 +00:00
|
|
|
|
|
|
|
if (v29[v116] == -1) {
|
|
|
|
if (v29[v116 + 1] == -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
v127 = 1;
|
|
|
|
}
|
|
|
|
} while (v127 != 1);
|
|
|
|
}
|
2013-01-12 10:55:44 +00:00
|
|
|
v74 = v137;
|
|
|
|
_vm->_globals.super_parcours[v74] = -1;
|
|
|
|
_vm->_globals.super_parcours[v74 + 1] = -1;
|
|
|
|
_vm->_globals.super_parcours[v74 + 2] = -1;
|
|
|
|
_vm->_globals.super_parcours[v74 + 3] = -1;
|
|
|
|
return 1;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
2013-01-09 07:05:58 +00:00
|
|
|
v9 = abs(v7 - a3);
|
2012-10-02 12:41:13 +00:00
|
|
|
v10 = v9 + 1;
|
2013-01-09 07:05:58 +00:00
|
|
|
v11 = abs(v90 - a4);
|
2012-10-02 12:41:13 +00:00
|
|
|
v107 = v11 + 1;
|
2012-10-22 12:28:54 +00:00
|
|
|
if (v10 > (int16)(v11 + 1))
|
2012-10-02 12:41:13 +00:00
|
|
|
v107 = v10;
|
|
|
|
v12 = v107 - 1;
|
|
|
|
v101 = 1000 * v10 / v12;
|
2012-10-22 12:28:54 +00:00
|
|
|
v99 = 1000 * (int16)(v11 + 1) / v12;
|
2012-10-02 12:41:13 +00:00
|
|
|
if (a3 < v7)
|
|
|
|
v101 = -v101;
|
|
|
|
if (a4 < v90)
|
|
|
|
v99 = -v99;
|
2012-10-22 12:28:54 +00:00
|
|
|
v13 = (int16)v101 / 1000;
|
|
|
|
v94 = (int16)v99 / 1000;
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = -1;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((int16)v99 / 1000 == -1 && (unsigned int)v101 <= 150)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 1;
|
|
|
|
if (v13 == 1) {
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v99 + 1) <= 151)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 3;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)v99 <= 150)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 3;
|
|
|
|
}
|
|
|
|
if (v94 == 1) {
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)v101 <= 150)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 5;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v101 + 150) <= 150)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 5;
|
|
|
|
}
|
|
|
|
if (v13 == -1) {
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)v99 <= 150)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 7;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v99 + 150) <= 150)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 7;
|
|
|
|
}
|
2012-12-21 07:12:02 +00:00
|
|
|
if (v94 == -1 && (unsigned int)(v101 + 150) <= 150)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 1;
|
2012-10-22 11:31:46 +00:00
|
|
|
if (v91 == -1 && !VERIF_SMOOTH(v7, v109, a3, a4) && SMOOTH_MOVE(v7, v109, a3, a4) != -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
break;
|
|
|
|
LABEL_72:
|
2013-01-09 07:05:58 +00:00
|
|
|
v19 = abs(v111 - a3);
|
2012-10-02 12:41:13 +00:00
|
|
|
v20 = v19 + 1;
|
2013-01-09 07:05:58 +00:00
|
|
|
v95 = abs(v109 - a4);
|
2012-10-02 12:41:13 +00:00
|
|
|
v108 = v95 + 1;
|
2013-01-12 13:50:53 +00:00
|
|
|
if (v20 > (v95 + 1))
|
2012-10-02 12:41:13 +00:00
|
|
|
v108 = v20;
|
|
|
|
if (v108 <= 10)
|
|
|
|
goto LABEL_149;
|
|
|
|
v21 = v108 - 1;
|
|
|
|
v102 = 1000 * v20 / v21;
|
2013-01-12 13:50:53 +00:00
|
|
|
v100 = 1000 * (v95 + 1) / v21;
|
2012-10-02 12:41:13 +00:00
|
|
|
if (a3 < v111)
|
|
|
|
v102 = -v102;
|
|
|
|
if (a4 < v109)
|
|
|
|
v100 = -v100;
|
2013-01-12 13:50:53 +00:00
|
|
|
v22 = v102 / 1000;
|
|
|
|
v96 = v100 / 1000;
|
2012-10-02 12:41:13 +00:00
|
|
|
v106 = 1000 * v111;
|
|
|
|
v105 = 1000 * v109;
|
|
|
|
v104 = 1000 * v111 / 1000;
|
|
|
|
v103 = v105 / 1000;
|
2013-01-12 13:50:53 +00:00
|
|
|
if (!(v102 / 1000) && v96 == -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 1;
|
|
|
|
if (v22 == 1) {
|
|
|
|
if (v96 == -1)
|
|
|
|
v91 = 2;
|
|
|
|
if (!v96)
|
|
|
|
v91 = 3;
|
|
|
|
if (v96 == 1)
|
|
|
|
v91 = 4;
|
|
|
|
}
|
|
|
|
if (!v22 && v96 == 1)
|
|
|
|
v91 = 5;
|
2013-01-12 13:50:53 +00:00
|
|
|
if ((v22 != -1) && (v96 == -1)) {
|
|
|
|
if (v102 >= 0 && v102 < 510)
|
|
|
|
v91 = 1;
|
|
|
|
else if (v102 >= 510 && v102 <= 1000)
|
|
|
|
v91 = 2;
|
|
|
|
} else {
|
|
|
|
if (v96 == 1)
|
|
|
|
v91 = 6;
|
|
|
|
else if (!v96)
|
|
|
|
v91 = 7;
|
|
|
|
else if (v96 == -1) {
|
|
|
|
if (v102 >= 0 && v102 < 510)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 1;
|
2013-01-12 13:50:53 +00:00
|
|
|
else if (v102 >= 510 && v102 <= 1000)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 2;
|
2013-01-12 13:50:53 +00:00
|
|
|
else
|
|
|
|
v91 = 8;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (v22 == 1) {
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v100 + 1) <= 511)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 2;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v100 + 510) <= 510)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 3;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)v100 <= 510)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 3;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v100 - 510) <= 490)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 4;
|
|
|
|
}
|
|
|
|
if (v96 == 1) {
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v102 - 510) <= 490)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 4;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)v102 <= 510)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 5;
|
2012-11-24 14:32:56 +00:00
|
|
|
// CHECKME: The two conditions on v102 are not compatible!
|
2012-10-02 12:41:13 +00:00
|
|
|
if (v102 >= -1 && v102 <= -510)
|
|
|
|
v91 = 6;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v102 + 510) <= 510)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 5;
|
|
|
|
}
|
|
|
|
if (v22 == -1) {
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v100 - 510) <= 490)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 6;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)v100 <= 510)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 7;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v100 + 1000) <= 490)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 8;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v100 + 510) <= 510)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 7;
|
|
|
|
}
|
|
|
|
if (v96 == -1) {
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v102 + 1000) <= 490)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 8;
|
2012-12-21 07:12:02 +00:00
|
|
|
if ((unsigned int)(v102 + 510) <= 510)
|
2012-10-02 12:41:13 +00:00
|
|
|
v91 = 1;
|
|
|
|
}
|
|
|
|
v23 = 0;
|
|
|
|
if (v108 + 1 <= 0)
|
|
|
|
goto LABEL_149;
|
2013-01-10 07:28:15 +00:00
|
|
|
while (!checkCollisionLine(v104, v103, &v143, &v142, 0, _linesNumb)) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v25 = v115;
|
|
|
|
v26 = _vm->_globals.essai0;
|
2012-10-19 11:19:50 +00:00
|
|
|
v26[v25] = v104;
|
|
|
|
v26[v25 + 1] = v103;
|
|
|
|
v26[v25 + 2] = v91;
|
2012-10-02 12:41:13 +00:00
|
|
|
v106 += v102;
|
|
|
|
v105 += v100;
|
|
|
|
v104 = v106 / 1000;
|
|
|
|
v103 = v105 / 1000;
|
|
|
|
v115 += 3;
|
|
|
|
++v23;
|
|
|
|
if (v23 >= v108 + 1)
|
|
|
|
goto LABEL_149;
|
|
|
|
}
|
2013-01-01 23:57:00 +00:00
|
|
|
if (_vm->_objectsManager._lastLine >= v142)
|
2012-10-02 12:41:13 +00:00
|
|
|
goto LABEL_157;
|
|
|
|
v24 = GENIAL(v142, v143, v104, v103, a3, a4, v115, _vm->_globals.essai0, 3);
|
|
|
|
if (v24 == -1)
|
|
|
|
goto LABEL_150;
|
|
|
|
v115 = v24;
|
|
|
|
if (NVPX != -1 || NVPY != -1) {
|
|
|
|
v142 = -1;
|
|
|
|
goto LABEL_157;
|
|
|
|
}
|
|
|
|
v7 = -1;
|
|
|
|
v90 = -1;
|
|
|
|
}
|
|
|
|
v91 = SMOOTH_SENS;
|
|
|
|
v14 = 0;
|
2012-11-24 14:32:56 +00:00
|
|
|
int v16;
|
2012-12-04 20:36:53 +00:00
|
|
|
for (;;) {
|
2013-01-22 06:53:59 +00:00
|
|
|
int v112 = SMOOTH[v14].field0;
|
2012-10-02 12:41:13 +00:00
|
|
|
v110 = SMOOTH[v14].field2;
|
2013-01-22 06:53:59 +00:00
|
|
|
if (v112 == -1 || SMOOTH[v14].field2 == -1) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v126 = 1;
|
2013-01-12 13:50:53 +00:00
|
|
|
if (v126 == 1) {
|
|
|
|
v18 = v14 - 1;
|
|
|
|
v111 = SMOOTH[v18].field0;
|
|
|
|
v109 = SMOOTH[v18].field2;
|
|
|
|
goto LABEL_72;
|
|
|
|
}
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
2013-01-22 06:53:59 +00:00
|
|
|
if (checkCollisionLine(v112, v110, &v143, &v142, 0, _linesNumb))
|
2012-10-02 12:41:13 +00:00
|
|
|
break;
|
|
|
|
v16 = v115;
|
2012-10-19 11:19:50 +00:00
|
|
|
|
2012-10-02 12:41:13 +00:00
|
|
|
v17 = _vm->_globals.essai0;
|
2012-10-19 11:19:50 +00:00
|
|
|
v17[v16] = v112;
|
2012-10-22 11:31:46 +00:00
|
|
|
v17[v16 + 1] = v110;
|
|
|
|
v17[v16 + 2] = v91;
|
2012-10-02 12:41:13 +00:00
|
|
|
v115 += 3;
|
|
|
|
++v14;
|
|
|
|
if (v126 == 1) {
|
|
|
|
v18 = v14 - 1;
|
|
|
|
v111 = SMOOTH[v18].field0;
|
|
|
|
v109 = SMOOTH[v18].field2;
|
|
|
|
goto LABEL_72;
|
|
|
|
}
|
|
|
|
}
|
2013-01-01 23:57:00 +00:00
|
|
|
if (v142 > _vm->_objectsManager._lastLine)
|
2013-01-12 13:50:53 +00:00
|
|
|
v142 = -1;
|
|
|
|
|
2012-10-02 12:41:13 +00:00
|
|
|
LABEL_157:
|
|
|
|
v31 = v115;
|
|
|
|
v32 = _vm->_globals.essai0;
|
2012-10-19 11:19:50 +00:00
|
|
|
v32[v31] = -1;
|
|
|
|
v32[v31 + 1] = -1;
|
|
|
|
v32[v31 + 2] = -1;
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2012-10-02 12:41:13 +00:00
|
|
|
v117 = 0;
|
|
|
|
v33 = v98;
|
|
|
|
v92 = v97;
|
|
|
|
LABEL_158:
|
|
|
|
v113 = v33;
|
|
|
|
if (a3 >= v33 - 2 && a3 <= v33 + 2 && a4 >= v92 - 2 && a4 <= v92 + 2)
|
|
|
|
goto LABEL_194;
|
|
|
|
if (v33 >= a3) {
|
|
|
|
LABEL_165:
|
|
|
|
if (v113 > a3) {
|
|
|
|
v36 = v113;
|
2013-01-10 07:28:15 +00:00
|
|
|
while (!checkCollisionLine(v36, v92, &v141, &v140, 0, _linesNumb)) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v37 = v117;
|
|
|
|
v38 = _vm->_globals.essai1;
|
2012-10-19 11:19:50 +00:00
|
|
|
v38[v37] = v36;
|
|
|
|
v38[v37 + 1] = v92;
|
|
|
|
v38[v37 + 2] = 7;
|
2012-10-02 12:41:13 +00:00
|
|
|
v117 += 3;
|
|
|
|
--v36;
|
|
|
|
if (a3 >= v36)
|
|
|
|
goto LABEL_171;
|
|
|
|
}
|
|
|
|
goto LABEL_168;
|
|
|
|
}
|
|
|
|
LABEL_171:
|
|
|
|
if (v92 >= a4) {
|
|
|
|
LABEL_181:
|
|
|
|
if (v92 > a4) {
|
|
|
|
v43 = v92;
|
|
|
|
do {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(a3, v43, &v141, &v140, 0, _linesNumb)) {
|
2013-01-01 23:57:00 +00:00
|
|
|
if (_vm->_objectsManager._lastLine < v140) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v44 = GENIAL(v140, v141, a3, v43, a3, a4, v117, _vm->_globals.essai1, 3);
|
|
|
|
if (v44 == -1)
|
|
|
|
goto LABEL_195;
|
|
|
|
v117 = v44;
|
|
|
|
if (NVPX != -1) {
|
|
|
|
if (NVPY != -1) {
|
|
|
|
v33 = NVPX;
|
|
|
|
v92 = NVPY;
|
2013-01-10 07:28:15 +00:00
|
|
|
v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine);
|
2013-01-12 13:50:53 +00:00
|
|
|
if (v45 && v140 <= _vm->_objectsManager._lastLine)
|
|
|
|
goto LABEL_202;
|
|
|
|
goto LABEL_158;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-01 23:57:00 +00:00
|
|
|
if (v140 <= _vm->_objectsManager._lastLine)
|
2012-10-02 12:41:13 +00:00
|
|
|
goto LABEL_202;
|
|
|
|
}
|
|
|
|
v46 = v117;
|
|
|
|
v47 = _vm->_globals.essai1;
|
2012-10-19 11:19:50 +00:00
|
|
|
v47[v46] = a3;
|
|
|
|
v47[v46 + 1] = v43;
|
|
|
|
v47[v46 + 2] = 1;
|
2012-10-02 12:41:13 +00:00
|
|
|
v117 += 3;
|
|
|
|
--v43;
|
|
|
|
} while (a4 < v43);
|
|
|
|
}
|
|
|
|
LABEL_194:
|
|
|
|
v48 = v117;
|
|
|
|
v49 = _vm->_globals.essai1;
|
2012-10-19 11:19:50 +00:00
|
|
|
v49[v48] = -1;
|
|
|
|
v49[v48 + 1] = -1;
|
|
|
|
v49[v48 + 2] = -1;
|
2012-10-02 12:41:13 +00:00
|
|
|
LABEL_195:
|
|
|
|
if (v117) {
|
|
|
|
v128 = 0;
|
|
|
|
v118 = 0;
|
|
|
|
v50 = _vm->_globals.essai1;
|
|
|
|
do {
|
|
|
|
v51 = v137;
|
2012-10-19 11:19:50 +00:00
|
|
|
_vm->_globals.super_parcours[v51] = v50[v118];
|
|
|
|
_vm->_globals.super_parcours[v51 + 1] = v50[v118 + 1];
|
|
|
|
_vm->_globals.super_parcours[v51 + 2] = v50[v118 + 2];
|
2012-10-02 12:41:13 +00:00
|
|
|
_vm->_globals.super_parcours[v51 + 3] = 0;
|
|
|
|
v118 += 3;
|
|
|
|
v137 += 4;
|
2012-10-19 11:19:50 +00:00
|
|
|
if (v50[v118] == -1 && v50[v118 + 1] == -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
v128 = 1;
|
|
|
|
} while (v128 != 1);
|
|
|
|
}
|
2013-01-12 10:55:44 +00:00
|
|
|
v74 = v137;
|
|
|
|
_vm->_globals.super_parcours[v74] = -1;
|
|
|
|
_vm->_globals.super_parcours[v74 + 1] = -1;
|
|
|
|
_vm->_globals.super_parcours[v74 + 2] = -1;
|
|
|
|
_vm->_globals.super_parcours[v74 + 3] = -1;
|
|
|
|
return 1;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
|
|
|
v39 = v92;
|
2012-12-04 20:36:53 +00:00
|
|
|
for (;;) {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(a3, v39, &v141, &v140, 0, _linesNumb)) {
|
2013-01-01 23:57:00 +00:00
|
|
|
if (_vm->_objectsManager._lastLine < v140) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v40 = GENIAL(v140, v141, a3, v39, a3, a4, v117, _vm->_globals.essai1, 3);
|
|
|
|
if (v40 == -1)
|
|
|
|
goto LABEL_195;
|
|
|
|
v117 = v40;
|
|
|
|
if (NVPX != -1) {
|
|
|
|
if (NVPY != -1) {
|
|
|
|
v33 = NVPX;
|
|
|
|
v92 = NVPY;
|
2013-01-10 07:28:15 +00:00
|
|
|
v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine);
|
2013-01-01 23:57:00 +00:00
|
|
|
if (v45 && v140 <= _vm->_objectsManager._lastLine)
|
2012-10-02 12:41:13 +00:00
|
|
|
goto LABEL_202;
|
|
|
|
goto LABEL_158;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-01 23:57:00 +00:00
|
|
|
if (v140 <= _vm->_objectsManager._lastLine)
|
2012-10-02 12:41:13 +00:00
|
|
|
goto LABEL_202;
|
|
|
|
}
|
|
|
|
v41 = v117;
|
2012-10-19 11:19:50 +00:00
|
|
|
|
2012-10-02 12:41:13 +00:00
|
|
|
v42 = _vm->_globals.essai1;
|
2012-10-19 11:19:50 +00:00
|
|
|
v42[v41] = a3;
|
|
|
|
v42[v41 + 1] = v39;
|
|
|
|
v42[v41 + 2] = 5;
|
2012-10-02 12:41:13 +00:00
|
|
|
v117 += 3;
|
|
|
|
++v39;
|
|
|
|
if (a4 <= v39)
|
|
|
|
goto LABEL_181;
|
|
|
|
}
|
|
|
|
}
|
2013-01-10 07:28:15 +00:00
|
|
|
while (!checkCollisionLine(v33, v92, &v141, &v140, 0, _linesNumb)) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v34 = v117;
|
|
|
|
v35 = _vm->_globals.essai1;
|
2012-10-19 11:19:50 +00:00
|
|
|
v35[v34] = v33;
|
|
|
|
v35[v34 + 1] = v92;
|
|
|
|
v35[v34 + 2] = 3;
|
2012-10-02 12:41:13 +00:00
|
|
|
v117 += 3;
|
|
|
|
++v33;
|
|
|
|
if (a3 <= v33)
|
|
|
|
goto LABEL_165;
|
|
|
|
}
|
|
|
|
LABEL_168:
|
2013-01-01 23:57:00 +00:00
|
|
|
if (v140 > _vm->_objectsManager._lastLine)
|
2012-10-02 12:41:13 +00:00
|
|
|
v140 = -1;
|
|
|
|
LABEL_202:
|
|
|
|
v52 = v117;
|
|
|
|
v53 = _vm->_globals.essai1;
|
2012-10-19 11:19:50 +00:00
|
|
|
v53[v52] = -1;
|
|
|
|
v53[v52 + 1] = -1;
|
|
|
|
v53[v52 + 2] = -1;
|
2012-10-02 12:41:13 +00:00
|
|
|
v117 = 0;
|
|
|
|
v54 = v98;
|
|
|
|
v93 = v97;
|
|
|
|
LABEL_203:
|
|
|
|
v114 = v54;
|
|
|
|
if (a3 >= v54 - 2 && a3 <= v54 + 2 && a4 >= v93 - 2 && a4 <= v93 + 2)
|
|
|
|
goto LABEL_241;
|
|
|
|
if (v93 < a4) {
|
|
|
|
v55 = v93;
|
2013-01-10 07:28:15 +00:00
|
|
|
while (!checkCollisionLine(v114, v55, &v139, &v138, 0, _linesNumb)) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v56 = v117;
|
|
|
|
v57 = _vm->_globals.essai2;
|
2012-10-19 11:19:50 +00:00
|
|
|
v57[v56] = v114;
|
|
|
|
v57[v56 + 1] = v55;
|
|
|
|
v57[v56 + 2] = 5;
|
2012-10-02 12:41:13 +00:00
|
|
|
v117 += 3;
|
|
|
|
++v55;
|
|
|
|
if (a4 <= v55)
|
|
|
|
goto LABEL_211;
|
|
|
|
}
|
|
|
|
goto LABEL_214;
|
|
|
|
}
|
|
|
|
LABEL_211:
|
|
|
|
if (v93 > a4) {
|
|
|
|
v58 = v93;
|
2013-01-10 07:28:15 +00:00
|
|
|
while (!checkCollisionLine(v114, v58, &v139, &v138, 0, _linesNumb)) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v59 = v117;
|
|
|
|
v60 = _vm->_globals.essai2;
|
2012-10-25 02:32:25 +00:00
|
|
|
v60[v59] = v114;
|
|
|
|
v60[v59 + 1] = v58;
|
|
|
|
v60[v59 + 2] = 1;
|
2012-10-02 12:41:13 +00:00
|
|
|
v117 += 3;
|
|
|
|
--v58;
|
|
|
|
if (a4 >= v58)
|
|
|
|
goto LABEL_217;
|
|
|
|
}
|
|
|
|
LABEL_214:
|
2013-01-01 23:57:00 +00:00
|
|
|
if (v138 > _vm->_objectsManager._lastLine)
|
2012-10-02 12:41:13 +00:00
|
|
|
v138 = -1;
|
|
|
|
LABEL_249:
|
|
|
|
v76 = v117;
|
|
|
|
v77 = _vm->_globals.essai2;
|
2012-10-25 02:32:25 +00:00
|
|
|
v77[v76] = -1;
|
|
|
|
v77[v76 + 1] = -1;
|
|
|
|
v77[v76 + 2] = -1;
|
|
|
|
|
2012-10-02 12:41:13 +00:00
|
|
|
if (v136 != 1) {
|
|
|
|
if (a6 > v144) {
|
2012-10-19 11:19:50 +00:00
|
|
|
if (_vm->_globals.essai0[0] != -1 && v142 > v144 && v140 <= v142 && v138 <= v142 && a6 >= v142) {
|
2012-10-02 12:41:13 +00:00
|
|
|
NV_LIGNEDEP = v142;
|
|
|
|
NV_LIGNEOFS = v143;
|
|
|
|
v130 = 0;
|
|
|
|
v120 = 0;
|
|
|
|
v78 = _vm->_globals.essai0;
|
|
|
|
do {
|
|
|
|
v79 = v137;
|
2012-10-19 11:19:50 +00:00
|
|
|
_vm->_globals.super_parcours[v79] = v78[v120];
|
|
|
|
_vm->_globals.super_parcours[v79 + 1] = v78[v120 + 1];
|
|
|
|
_vm->_globals.super_parcours[v79 + 2] = v78[v120 + 2];
|
2012-10-02 12:41:13 +00:00
|
|
|
_vm->_globals.super_parcours[v79 + 3] = 0;
|
|
|
|
v120 += 3;
|
|
|
|
v137 += 4;
|
2012-10-19 11:19:50 +00:00
|
|
|
if (v78[v120] == -1 && v78[v120 + 1] == -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
v130 = 1;
|
|
|
|
} while (v130 != 1);
|
|
|
|
NV_POSI = v137;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
v80 = _vm->_globals.essai1;
|
2012-10-20 06:47:57 +00:00
|
|
|
if (_vm->_globals.essai1[0] != -1 && v144 < v140 && v138 <= v140 && v142 <= v140 && a6 >= v140) {
|
2012-10-02 12:41:13 +00:00
|
|
|
NV_LIGNEDEP = v140;
|
|
|
|
NV_LIGNEOFS = v141;
|
|
|
|
v131 = 0;
|
|
|
|
v121 = 0;
|
|
|
|
do {
|
2012-10-25 02:32:25 +00:00
|
|
|
assert(137 <= 32000);
|
2012-10-02 12:41:13 +00:00
|
|
|
v81 = v137;
|
2012-10-19 11:19:50 +00:00
|
|
|
_vm->_globals.super_parcours[v81] = v80[v121];
|
|
|
|
_vm->_globals.super_parcours[v81 + 1] = v80[v121 + 1];
|
|
|
|
_vm->_globals.super_parcours[v81 + 2] = v80[v121 + 2];
|
2012-10-02 12:41:13 +00:00
|
|
|
_vm->_globals.super_parcours[v81 + 3] = 0;
|
|
|
|
v121 += 3;
|
|
|
|
v137 += 4;
|
2012-10-19 11:19:50 +00:00
|
|
|
if (v80[v121] == -1 && v80[v121 + 1] == -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
v131 = 1;
|
|
|
|
} while (v131 != 1);
|
|
|
|
NV_POSI = v137;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
v82 = _vm->_globals.essai2;
|
2012-10-20 06:47:57 +00:00
|
|
|
if (_vm->_globals.essai2[0] != -1) {
|
2012-10-02 12:41:13 +00:00
|
|
|
if (v144 < v138 && v140 < v138 && v142 < v138 && a6 >= v138) {
|
|
|
|
NV_LIGNEDEP = v138;
|
|
|
|
NV_LIGNEOFS = v139;
|
|
|
|
v132 = 0;
|
|
|
|
v122 = 0;
|
|
|
|
do {
|
2012-10-25 02:32:25 +00:00
|
|
|
assert(v137 <= 32000);
|
2012-10-02 12:41:13 +00:00
|
|
|
v83 = v137;
|
2012-10-19 11:19:50 +00:00
|
|
|
_vm->_globals.super_parcours[v83] = v82[v122];
|
|
|
|
_vm->_globals.super_parcours[v83 + 1] = v82[v122 + 1];
|
|
|
|
_vm->_globals.super_parcours[v83 + 2] = v82[v122 + 2];
|
2012-10-02 12:41:13 +00:00
|
|
|
_vm->_globals.super_parcours[v83 + 3] = 0;
|
|
|
|
v122 += 3;
|
|
|
|
v137 += 4;
|
2012-10-19 11:19:50 +00:00
|
|
|
if (v82[v122] == -1 && v82[v122 + 1] == -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
v132 = 1;
|
|
|
|
} while (v132 != 1);
|
|
|
|
NV_POSI = v137;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (a6 < v144) {
|
|
|
|
if (v142 == -1)
|
|
|
|
v142 = 1300;
|
|
|
|
if (v140 == -1)
|
|
|
|
v142 = 1300;
|
|
|
|
if (v138 == -1)
|
|
|
|
v142 = 1300;
|
2012-10-19 11:19:50 +00:00
|
|
|
if (_vm->_globals.essai1[0] != -1 && v140 < v144 && v138 >= v140 && v142 >= v140 && a6 <= v140) {
|
2012-10-02 12:41:13 +00:00
|
|
|
NV_LIGNEDEP = v140;
|
|
|
|
NV_LIGNEOFS = v141;
|
|
|
|
v133 = 0;
|
|
|
|
v123 = 0;
|
|
|
|
v84 = _vm->_globals.essai1;
|
|
|
|
do {
|
2012-10-25 02:32:25 +00:00
|
|
|
assert(137 <= 32000);
|
2012-10-02 12:41:13 +00:00
|
|
|
v85 = v137;
|
2012-10-19 11:19:50 +00:00
|
|
|
_vm->_globals.super_parcours[v85] = v84[v123];
|
|
|
|
_vm->_globals.super_parcours[v85 + 1] = v84[v123 + 1];
|
|
|
|
_vm->_globals.super_parcours[v85 + 2] = v84[v123 + 2];
|
2012-10-02 12:41:13 +00:00
|
|
|
_vm->_globals.super_parcours[v85 + 3] = 0;
|
|
|
|
v123 += 3;
|
|
|
|
v137 += 4;
|
2012-10-19 11:19:50 +00:00
|
|
|
if (v84[v123] == -1 && v84[v123 + 1] == -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
v133 = 1;
|
|
|
|
} while (v133 != 1);
|
2013-01-12 13:50:53 +00:00
|
|
|
NV_POSI = v137;
|
|
|
|
return 2;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
|
|
|
v86 = _vm->_globals.essai2;
|
2012-10-19 11:19:50 +00:00
|
|
|
if (_vm->_globals.essai2[0] != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) {
|
2012-10-02 12:41:13 +00:00
|
|
|
NV_LIGNEDEP = v138;
|
|
|
|
NV_LIGNEOFS = v139;
|
|
|
|
v134 = 0;
|
|
|
|
v124 = 0;
|
|
|
|
do {
|
2012-10-25 02:32:25 +00:00
|
|
|
assert(137 <= 32000);
|
2012-10-02 12:41:13 +00:00
|
|
|
v87 = v137;
|
2012-10-19 11:19:50 +00:00
|
|
|
_vm->_globals.super_parcours[v87] = v86[v124];
|
|
|
|
_vm->_globals.super_parcours[v87 + 1] = v86[v124 + 1];
|
|
|
|
_vm->_globals.super_parcours[v87 + 2] = v86[v124 + 2];
|
2012-10-02 12:41:13 +00:00
|
|
|
_vm->_globals.super_parcours[v87 + 3] = 0;
|
|
|
|
v124 += 3;
|
|
|
|
v137 += 4;
|
2012-10-19 11:19:50 +00:00
|
|
|
if (v86[v124] == -1 && v86[v124 + 1] == -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
v134 = 1;
|
|
|
|
} while (v134 != 1);
|
2013-01-12 13:50:53 +00:00
|
|
|
NV_POSI = v137;
|
|
|
|
return 2;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
2012-10-19 11:19:50 +00:00
|
|
|
if (_vm->_globals.essai1[0] != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) {
|
2012-10-02 12:41:13 +00:00
|
|
|
NV_LIGNEDEP = v142;
|
|
|
|
NV_LIGNEOFS = v143;
|
|
|
|
v135 = 0;
|
|
|
|
v125 = 0;
|
|
|
|
v88 = _vm->_globals.essai0;
|
|
|
|
do {
|
2012-10-25 02:32:25 +00:00
|
|
|
assert(137 <= 32000);
|
2012-10-02 12:41:13 +00:00
|
|
|
v89 = v137;
|
2012-10-19 11:19:50 +00:00
|
|
|
_vm->_globals.super_parcours[v89] = v88[v125];
|
|
|
|
_vm->_globals.super_parcours[v89 + 1] = v88[v125 + 1];
|
|
|
|
_vm->_globals.super_parcours[v89 + 2] = v88[v125 + 2];
|
2012-10-02 12:41:13 +00:00
|
|
|
_vm->_globals.super_parcours[v89 + 3] = 0;
|
|
|
|
v125 += 3;
|
|
|
|
v137 += 4;
|
2012-10-19 11:19:50 +00:00
|
|
|
if (v88[v125] == -1 && v88[v125 + 1] == -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
v135 = 1;
|
|
|
|
} while (v135 != 1);
|
2013-01-12 13:50:53 +00:00
|
|
|
|
|
|
|
NV_POSI = v137;
|
|
|
|
return 2;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
LABEL_217:
|
|
|
|
if (v114 < a3) {
|
|
|
|
v61 = v114;
|
|
|
|
do {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(v61, a4, &v139, &v138, 0, _linesNumb)) {
|
2013-01-01 23:57:00 +00:00
|
|
|
if (_vm->_objectsManager._lastLine < v138) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v62 = GENIAL(v138, v139, v61, a4, a3, a4, v117, _vm->_globals.essai2, 3);
|
|
|
|
if (v62 == -1)
|
|
|
|
goto LABEL_195;
|
|
|
|
v117 = v62;
|
|
|
|
if (NVPX != -1) {
|
|
|
|
if (NVPY != -1) {
|
|
|
|
v54 = NVPX;
|
|
|
|
v93 = NVPY;
|
2013-01-10 07:28:15 +00:00
|
|
|
colResult = checkCollisionLine(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine);
|
2013-01-01 23:57:00 +00:00
|
|
|
if (colResult && v138 <= _vm->_objectsManager._lastLine)
|
2012-10-02 12:41:13 +00:00
|
|
|
goto LABEL_249;
|
|
|
|
goto LABEL_203;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-01 23:57:00 +00:00
|
|
|
if (v138 <= _vm->_objectsManager._lastLine)
|
2012-10-02 12:41:13 +00:00
|
|
|
goto LABEL_249;
|
|
|
|
}
|
|
|
|
v63 = v117;
|
2012-10-19 11:19:50 +00:00
|
|
|
|
2012-10-02 12:41:13 +00:00
|
|
|
v64 = _vm->_globals.essai2;
|
2012-10-19 11:19:50 +00:00
|
|
|
v64[v63] = v61;
|
|
|
|
v64[v63 + 1] = a4;
|
|
|
|
v64[v63 + 2] = 3;
|
2012-10-02 12:41:13 +00:00
|
|
|
v117 += 3;
|
|
|
|
++v61;
|
|
|
|
} while (a3 > v61);
|
|
|
|
}
|
|
|
|
if (v114 > a3) {
|
|
|
|
v65 = v114;
|
|
|
|
do {
|
2013-01-10 07:28:15 +00:00
|
|
|
if (checkCollisionLine(v65, a4, &v139, &v138, 0, _linesNumb)) {
|
2013-01-01 23:57:00 +00:00
|
|
|
if (_vm->_objectsManager._lastLine < v138) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v66 = GENIAL(v138, v139, v65, a4, a3, a4, v117, _vm->_globals.essai2, 3);
|
|
|
|
if (v66 == -1)
|
|
|
|
goto LABEL_242;
|
|
|
|
v117 = v66;
|
|
|
|
if (NVPX != -1) {
|
|
|
|
if (NVPY != -1) {
|
|
|
|
v54 = NVPX;
|
|
|
|
v93 = NVPY;
|
2013-01-10 07:28:15 +00:00
|
|
|
colResult = checkCollisionLine(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine);
|
2013-01-12 13:50:53 +00:00
|
|
|
if (colResult && v138 <= _vm->_objectsManager._lastLine)
|
|
|
|
goto LABEL_249;
|
|
|
|
goto LABEL_203;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-01 23:57:00 +00:00
|
|
|
if (v138 <= _vm->_objectsManager._lastLine)
|
2012-10-02 12:41:13 +00:00
|
|
|
goto LABEL_249;
|
|
|
|
}
|
2013-01-12 10:55:44 +00:00
|
|
|
_vm->_globals.essai2[v117] = v65;
|
|
|
|
_vm->_globals.essai2[v117 + 1] = a4;
|
|
|
|
_vm->_globals.essai2[v117 + 2] = 7;
|
2012-10-02 12:41:13 +00:00
|
|
|
v117 += 3;
|
|
|
|
--v65;
|
|
|
|
} while (a3 < v65);
|
|
|
|
}
|
|
|
|
v138 = -1;
|
|
|
|
LABEL_241:
|
2013-01-12 10:55:44 +00:00
|
|
|
_vm->_globals.essai2[v117] = -1;
|
|
|
|
_vm->_globals.essai2[v117 + 1] = -1;
|
|
|
|
_vm->_globals.essai2[v117 + 2] = -1;
|
2012-10-02 12:41:13 +00:00
|
|
|
LABEL_242:
|
|
|
|
if (v117) {
|
|
|
|
v129 = 0;
|
|
|
|
v119 = 0;
|
|
|
|
v72 = _vm->_globals.essai2;
|
|
|
|
do {
|
|
|
|
v73 = v137;
|
2012-10-19 11:19:50 +00:00
|
|
|
_vm->_globals.super_parcours[v73] = v72[v119];
|
|
|
|
_vm->_globals.super_parcours[v73 + 1] = v72[v119 + 1];
|
|
|
|
_vm->_globals.super_parcours[v73 + 2] = v72[v119 + 2];
|
2012-10-02 12:41:13 +00:00
|
|
|
_vm->_globals.super_parcours[v73 + 3] = 0;
|
|
|
|
v119 += 3;
|
|
|
|
v137 += 4;
|
2012-10-19 11:19:50 +00:00
|
|
|
if (v72[v119] == -1 && v72[v119 + 1] == -1)
|
2012-10-02 12:41:13 +00:00
|
|
|
v129 = 1;
|
|
|
|
} while (v129 != 1);
|
|
|
|
}
|
|
|
|
v74 = v137;
|
|
|
|
_vm->_globals.super_parcours[v74] = -1;
|
|
|
|
_vm->_globals.super_parcours[v74 + 1] = -1;
|
|
|
|
_vm->_globals.super_parcours[v74 + 2] = -1;
|
|
|
|
_vm->_globals.super_parcours[v74 + 3] = -1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) {
|
2012-12-14 00:49:22 +00:00
|
|
|
int v6;
|
|
|
|
int v7;
|
|
|
|
int v8;
|
|
|
|
int v9;
|
|
|
|
int v12;
|
|
|
|
int v14;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v15;
|
|
|
|
int v16;
|
2012-12-14 00:49:22 +00:00
|
|
|
int v17;
|
|
|
|
int v18;
|
2012-10-02 12:41:13 +00:00
|
|
|
|
2013-01-12 10:55:44 +00:00
|
|
|
int v5 = abs(a1 - a3) + 1;
|
|
|
|
int v13 = abs(a2 - a4) + 1;
|
|
|
|
if (v5 > v13)
|
2012-10-02 12:41:13 +00:00
|
|
|
v13 = v5;
|
|
|
|
if (v13 <= 10)
|
|
|
|
return -1;
|
|
|
|
v6 = v13 - 1;
|
|
|
|
v16 = 1000 * v5 / v6;
|
2013-01-12 10:55:44 +00:00
|
|
|
v15 = 1000 * (abs(a2 - a4) + 1) / v6;
|
2012-10-02 12:41:13 +00:00
|
|
|
if (a3 < a1)
|
|
|
|
v16 = -v16;
|
|
|
|
if (a4 < a2)
|
|
|
|
v15 = -v15;
|
|
|
|
v7 = 1000 * a1;
|
|
|
|
v8 = 1000 * a2;
|
|
|
|
v9 = 1000 * a1 / 1000;
|
|
|
|
v12 = 1000 * a2 / 1000;
|
|
|
|
v14 = 0;
|
|
|
|
if (v13 + 1 > 0) {
|
2013-01-10 07:28:15 +00:00
|
|
|
while (!checkCollisionLine(v9, v12, &v18, &v17, 0, _linesNumb) || v17 > _vm->_objectsManager._lastLine) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v7 += v16;
|
|
|
|
v8 += v15;
|
|
|
|
v9 = v7 / 1000;
|
|
|
|
v12 = v8 / 1000;
|
|
|
|
++v14;
|
|
|
|
if (v14 >= v13 + 1)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-22 11:31:46 +00:00
|
|
|
int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) {
|
2012-12-14 00:49:22 +00:00
|
|
|
int v6;
|
|
|
|
int v7;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v11;
|
2012-12-14 00:49:22 +00:00
|
|
|
int v14;
|
|
|
|
int v22;
|
|
|
|
int v25;
|
2012-10-02 12:41:13 +00:00
|
|
|
int v33;
|
2012-12-14 00:49:22 +00:00
|
|
|
int v37;
|
|
|
|
int v38;
|
|
|
|
int v39;
|
|
|
|
int v40;
|
|
|
|
int v41;
|
|
|
|
int v42;
|
|
|
|
int v50;
|
|
|
|
int v51;
|
|
|
|
int v52;
|
2013-01-11 23:38:23 +00:00
|
|
|
int hopkinsIdx;
|
|
|
|
int smoothIdx;
|
|
|
|
|
|
|
|
int v62 = a3;
|
|
|
|
int v63 = a4;
|
|
|
|
if (a3 > a5 && a6 > a4) {
|
|
|
|
hopkinsIdx = 36;
|
|
|
|
smoothIdx = 0;
|
|
|
|
int loopCount = 0;
|
|
|
|
while (v62 > a5 && a6 > v63) {
|
|
|
|
v25 = _vm->_globals.Hopkins[hopkinsIdx].field0;
|
|
|
|
v40 = _vm->_globals.Hopkins[hopkinsIdx].field2;
|
2013-01-22 06:53:59 +00:00
|
|
|
int spriteSize = _vm->_globals._spriteSize[v63];
|
2013-01-11 23:38:23 +00:00
|
|
|
if (spriteSize < 0) {
|
|
|
|
v25 = _vm->_graphicsManager.zoomOut(v25, -spriteSize);
|
|
|
|
v40 = _vm->_graphicsManager.zoomOut(v40, -spriteSize);
|
|
|
|
} else if (spriteSize > 0) {
|
|
|
|
v25 = _vm->_graphicsManager.zoomIn(v25, spriteSize);
|
|
|
|
v40 = _vm->_graphicsManager.zoomIn(v40, spriteSize);
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
2013-01-11 23:38:23 +00:00
|
|
|
v33 = v63 + v40;
|
|
|
|
for (int v34 = 0; v34 < v25; v34++) {
|
|
|
|
--v62;
|
|
|
|
SMOOTH[smoothIdx].field0 = v62;
|
|
|
|
if (v63 != v33)
|
|
|
|
v63++;
|
|
|
|
SMOOTH[smoothIdx].field2 = v63;
|
|
|
|
smoothIdx++;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
2013-01-11 23:38:23 +00:00
|
|
|
++hopkinsIdx;
|
|
|
|
if (hopkinsIdx == 48)
|
|
|
|
hopkinsIdx = 36;
|
|
|
|
++loopCount;
|
|
|
|
}
|
|
|
|
if (loopCount > 5) {
|
|
|
|
SMOOTH[smoothIdx].field0 = -1;
|
|
|
|
SMOOTH[smoothIdx].field2 = -1;
|
|
|
|
_vm->_linesManager.SMOOTH_SENS = 6;
|
|
|
|
SMOOTH_X = v62;
|
|
|
|
SMOOTH_Y = v63;
|
|
|
|
return 0;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
2013-01-11 23:38:23 +00:00
|
|
|
} else if (a3 < a5 && a6 > a4) {
|
|
|
|
v52 = 36;
|
|
|
|
smoothIdx = 0;
|
|
|
|
int loopCount = 0;
|
|
|
|
while (v62 < a5 && a6 > v63) {
|
|
|
|
v14 = _vm->_globals.Hopkins[v52].field0;
|
|
|
|
v39 = _vm->_globals.Hopkins[v52].field2;
|
2013-01-22 06:53:59 +00:00
|
|
|
int spriteSize = _vm->_globals._spriteSize[v63];
|
2013-01-11 23:38:23 +00:00
|
|
|
if (spriteSize < 0) {
|
|
|
|
v14 = _vm->_graphicsManager.zoomOut(v14, -spriteSize);
|
|
|
|
v39 = _vm->_graphicsManager.zoomOut(v39, -spriteSize);
|
|
|
|
}
|
|
|
|
if (spriteSize > 0) {
|
|
|
|
v14 = _vm->_graphicsManager.zoomIn(v14, spriteSize);
|
|
|
|
v39 = _vm->_graphicsManager.zoomIn(v39, spriteSize);
|
|
|
|
}
|
|
|
|
v22 = v63 + v39;
|
|
|
|
for (int i = 0; i < v14; i++) {
|
|
|
|
++v62;
|
|
|
|
SMOOTH[smoothIdx].field0 = v62;
|
|
|
|
if (v63 != v22)
|
|
|
|
v63++;
|
|
|
|
SMOOTH[smoothIdx].field2 = v63;
|
|
|
|
smoothIdx++;
|
|
|
|
}
|
|
|
|
++v52;
|
|
|
|
if (v52 == 48)
|
|
|
|
v52 = 36;
|
|
|
|
++loopCount;
|
|
|
|
}
|
|
|
|
if (loopCount > 5) {
|
|
|
|
SMOOTH[smoothIdx].field0 = -1;
|
|
|
|
SMOOTH[smoothIdx].field2 = -1;
|
|
|
|
_vm->_linesManager.SMOOTH_SENS = 4;
|
|
|
|
SMOOTH_X = v62;
|
|
|
|
SMOOTH_Y = v63;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} else if (a3 > a5 && a6 < a4) {
|
|
|
|
v51 = 12;
|
|
|
|
smoothIdx = 0;
|
|
|
|
int loopCount = 0;
|
|
|
|
while (v62 > a5 && a6 < v63) {
|
|
|
|
v42 = v63;
|
|
|
|
v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field0, 25);
|
2013-01-22 06:53:59 +00:00
|
|
|
v38 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field2, 25);
|
2013-01-11 23:38:23 +00:00
|
|
|
v63 = v42;
|
|
|
|
for (int v12 = 0; v12 < v11; v12++) {
|
|
|
|
--v62;
|
|
|
|
SMOOTH[smoothIdx].field0 = v62;
|
|
|
|
if ((uint16)v63 != (uint16)v42 + v38)
|
|
|
|
v63--;
|
|
|
|
SMOOTH[smoothIdx].field2 = v63;
|
|
|
|
smoothIdx++;
|
|
|
|
}
|
|
|
|
++v51;
|
|
|
|
if (v51 == 24)
|
|
|
|
v51 = 12;
|
|
|
|
++loopCount;
|
|
|
|
}
|
|
|
|
if (loopCount > 5) {
|
|
|
|
SMOOTH[smoothIdx].field0 = -1;
|
|
|
|
SMOOTH[smoothIdx].field2 = -1;
|
|
|
|
_vm->_linesManager.SMOOTH_SENS = 8;
|
|
|
|
SMOOTH_X = v62;
|
|
|
|
SMOOTH_Y = v63;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} else if (a3 < a5 && a6 < a4) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v50 = 12;
|
2013-01-23 20:44:31 +00:00
|
|
|
smoothIdx = 0;
|
2013-01-11 23:38:23 +00:00
|
|
|
int loopCount = 0;
|
|
|
|
while (v62 < a5 && a6 < v63) {
|
2012-10-02 12:41:13 +00:00
|
|
|
v6 = _vm->_globals.Hopkins[v50].field2;
|
2012-10-22 11:31:46 +00:00
|
|
|
v41 = v63;
|
2012-12-21 07:12:02 +00:00
|
|
|
v7 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v50].field0, 25);
|
|
|
|
v37 = _vm->_graphicsManager.zoomOut(v6, 25);
|
2012-10-22 11:31:46 +00:00
|
|
|
v63 = v41;
|
2012-12-30 23:18:08 +00:00
|
|
|
for (int v8 = 0; v8 < v7; v8++) {
|
|
|
|
++v62;
|
2013-01-11 23:38:23 +00:00
|
|
|
SMOOTH[smoothIdx].field0 = v62;
|
2012-12-30 23:18:08 +00:00
|
|
|
if ((uint16)v63 != (uint16)v41 + v37)
|
|
|
|
v63--;
|
2013-01-11 23:38:23 +00:00
|
|
|
SMOOTH[smoothIdx].field2 = v63;
|
|
|
|
smoothIdx++;
|
2012-10-02 12:41:13 +00:00
|
|
|
}
|
|
|
|
++v50;
|
|
|
|
if (v50 == 24)
|
|
|
|
v50 = 12;
|
2013-01-11 23:38:23 +00:00
|
|
|
++loopCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (loopCount > 5) {
|
|
|
|
SMOOTH[smoothIdx].field0 = -1;
|
|
|
|
SMOOTH[smoothIdx].field2 = -1;
|
2012-10-02 12:41:13 +00:00
|
|
|
_vm->_linesManager.SMOOTH_SENS = 2;
|
|
|
|
SMOOTH_X = v62;
|
2012-10-22 11:31:46 +00:00
|
|
|
SMOOTH_Y = v63;
|
2012-10-02 12:41:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
2012-10-02 11:44:23 +00:00
|
|
|
|
2013-01-11 18:19:49 +00:00
|
|
|
bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) {
|
2012-12-14 00:49:22 +00:00
|
|
|
int v42;
|
|
|
|
int v43;
|
|
|
|
int v44;
|
|
|
|
int v45;
|
2013-01-11 18:19:49 +00:00
|
|
|
int dataIdxTestUp;
|
|
|
|
int dataIdxTestDown;
|
|
|
|
int dataIdxTestLeft;
|
|
|
|
int dataIdxTestRight;
|
|
|
|
int lineIdxTestUp;
|
|
|
|
int lineIdxTestDown;
|
|
|
|
int lineIdxTestLeft;
|
|
|
|
int lineIdxTestRight;
|
|
|
|
|
|
|
|
int idxTestUp = TEST_LIGNE(paramX, paramY - 2, &v42, &lineIdxTestUp, &dataIdxTestUp);
|
|
|
|
int idxTestDown = TEST_LIGNE(paramX, paramY + 2, &v43, &lineIdxTestDown, &dataIdxTestDown);
|
|
|
|
int idxTestLeft = TEST_LIGNE(paramX - 2, paramY, &v44, &lineIdxTestLeft, &dataIdxTestLeft);
|
|
|
|
int idxTestRight = TEST_LIGNE(paramX + 2, paramY, &v45, &lineIdxTestRight, &dataIdxTestRight);
|
|
|
|
if (idxTestUp == -1 && idxTestDown == -1 && idxTestLeft == -1 && idxTestRight == -1)
|
2013-01-11 00:50:29 +00:00
|
|
|
return false;
|
2013-01-11 18:19:49 +00:00
|
|
|
|
|
|
|
int v8;
|
2012-10-04 12:44:29 +00:00
|
|
|
if (a4 == -1 || a5 == -1) {
|
2013-01-11 18:19:49 +00:00
|
|
|
if (idxTestUp != -1)
|
2012-10-04 12:44:29 +00:00
|
|
|
v8 = 1;
|
2013-01-11 18:19:49 +00:00
|
|
|
else if (idxTestDown != -1)
|
2012-10-04 12:44:29 +00:00
|
|
|
v8 = 2;
|
2013-01-11 18:19:49 +00:00
|
|
|
else if (idxTestLeft != -1)
|
2012-10-04 12:44:29 +00:00
|
|
|
v8 = 3;
|
2013-01-11 18:19:49 +00:00
|
|
|
else if (idxTestRight != -1)
|
2012-10-04 12:44:29 +00:00
|
|
|
v8 = 4;
|
2013-01-11 18:19:49 +00:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
int v28 = 100;
|
|
|
|
int v7 = 100;
|
|
|
|
int v35 = 100;
|
|
|
|
int v27 = 100;
|
|
|
|
int v36 = abs(a4 - a5);
|
|
|
|
if (idxTestUp != -1) {
|
|
|
|
v28 = abs(lineIdxTestUp - a5);
|
|
|
|
}
|
|
|
|
if (idxTestDown != -1) {
|
|
|
|
v7 = abs(lineIdxTestDown - a5);
|
|
|
|
}
|
|
|
|
if (idxTestLeft != -1) {
|
|
|
|
v35 = abs(lineIdxTestLeft - a5);
|
|
|
|
}
|
|
|
|
if (idxTestRight != -1) {
|
|
|
|
v27 = abs(lineIdxTestRight - a5);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (v28 < v36 && v28 <= v7 && v28 <= v35 && v28 <= v27)
|
|
|
|
v8 = 1;
|
|
|
|
else if (v36 > v7 && v28 >= v7 && v35 >= v7 && v27 >= v7)
|
|
|
|
v8 = 2;
|
|
|
|
else if (v35 < v36 && v35 <= v28 && v35 <= v7 && v35 <= v27)
|
|
|
|
v8 = 3;
|
|
|
|
else if (v27 < v36 && v27 <= v28 && v27 <= v7 && v27 <= v35)
|
|
|
|
v8 = 4;
|
|
|
|
else
|
|
|
|
return false;
|
2012-10-04 12:44:29 +00:00
|
|
|
}
|
2013-01-11 18:19:49 +00:00
|
|
|
|
|
|
|
int v33 = 0;
|
|
|
|
int idxTest = 0;
|
2012-10-04 12:44:29 +00:00
|
|
|
if (v8 == 1) {
|
2013-01-11 18:19:49 +00:00
|
|
|
idxTest = idxTestUp;
|
2012-10-04 12:44:29 +00:00
|
|
|
v33 = v42;
|
2013-01-11 18:19:49 +00:00
|
|
|
NV_LIGNEDEP = lineIdxTestUp;
|
|
|
|
NV_LIGNEOFS = dataIdxTestUp;
|
|
|
|
} else if (v8 == 2) {
|
|
|
|
idxTest = idxTestDown;
|
2012-10-04 12:44:29 +00:00
|
|
|
v33 = v43;
|
2013-01-11 18:19:49 +00:00
|
|
|
NV_LIGNEDEP = lineIdxTestDown;
|
|
|
|
NV_LIGNEOFS = dataIdxTestDown;
|
|
|
|
} else if (v8 == 3) {
|
|
|
|
idxTest = idxTestLeft;
|
2012-10-04 12:44:29 +00:00
|
|
|
v33 = v44;
|
2013-01-11 18:19:49 +00:00
|
|
|
NV_LIGNEDEP = lineIdxTestLeft;
|
|
|
|
NV_LIGNEOFS = dataIdxTestLeft;
|
|
|
|
} else if (v8 == 4) {
|
|
|
|
idxTest = idxTestRight;
|
2012-10-04 12:44:29 +00:00
|
|
|
v33 = v45;
|
2013-01-11 18:19:49 +00:00
|
|
|
NV_LIGNEDEP = lineIdxTestRight;
|
|
|
|
NV_LIGNEOFS = dataIdxTestRight;
|
2012-10-04 12:44:29 +00:00
|
|
|
}
|
2013-01-11 18:19:49 +00:00
|
|
|
|
2013-01-11 20:27:04 +00:00
|
|
|
int superRouteIdx = a3;
|
2012-10-04 12:44:29 +00:00
|
|
|
if (v33 == 1) {
|
2013-01-11 18:19:49 +00:00
|
|
|
_vm->_globals.essai0 = _vm->_globals.essai0;
|
|
|
|
for (int i = 0; i < Ligne[idxTest]._lineDataEndIdx; i++) {
|
2013-01-11 20:27:04 +00:00
|
|
|
_vm->_globals.super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * i];
|
|
|
|
_vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * i + 1];
|
|
|
|
_vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[idxTest].field6;
|
|
|
|
_vm->_globals.super_parcours[superRouteIdx + 3] = 0;
|
|
|
|
superRouteIdx += 4;
|
2013-01-11 18:19:49 +00:00
|
|
|
}
|
|
|
|
} else if (v33 == 2) {
|
|
|
|
for (int v19 = Ligne[idxTest]._lineDataEndIdx - 1; v19 > -1; v19--) {
|
2013-01-11 20:27:04 +00:00
|
|
|
_vm->_globals.super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * v19];
|
|
|
|
_vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * v19 + 1];
|
|
|
|
_vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[idxTest].field8;
|
|
|
|
_vm->_globals.super_parcours[superRouteIdx + 3] = 0;
|
|
|
|
superRouteIdx += 4;
|
2012-10-04 12:44:29 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-11 20:27:04 +00:00
|
|
|
NV_POSI = superRouteIdx;
|
2013-01-11 00:50:29 +00:00
|
|
|
return true;
|
2012-10-04 12:44:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-20 16:59:06 +00:00
|
|
|
// Test line
|
2013-01-11 18:19:49 +00:00
|
|
|
int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx) {
|
2013-01-11 07:16:47 +00:00
|
|
|
int16 *lineData;
|
|
|
|
int lineDataEndIdx;
|
|
|
|
int collLineIdx;
|
|
|
|
int collDataIdx;
|
|
|
|
|
|
|
|
for (int idx = _vm->_objectsManager._lastLine + 1; idx < _vm->_linesManager._linesNumb + 1; idx++) {
|
|
|
|
lineData = Ligne[idx]._lineData;
|
|
|
|
lineDataEndIdx = Ligne[idx]._lineDataEndIdx;
|
2013-01-11 18:19:49 +00:00
|
|
|
if (lineData[0] == paramX && lineData[1] == paramY) {
|
2012-10-04 12:44:29 +00:00
|
|
|
*a3 = 1;
|
2013-01-11 07:16:47 +00:00
|
|
|
int posX = lineData[2 * (lineDataEndIdx - 1)];
|
|
|
|
int posY = lineData[2 * (lineDataEndIdx - 1) + 1];
|
|
|
|
if (Ligne[idx].field6 == 5 || Ligne[idx].field6 == 1)
|
|
|
|
posY += 2;
|
|
|
|
if (Ligne[idx].field6 == 3 || Ligne[idx].field8 == 7)
|
|
|
|
posX += 2;
|
|
|
|
if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _vm->_objectsManager._lastLine))
|
|
|
|
error("Error in test line");
|
|
|
|
*foundLineIdx = collLineIdx;
|
|
|
|
*foundDataIdx = collDataIdx;
|
|
|
|
return idx;
|
|
|
|
}
|
2013-01-11 18:19:49 +00:00
|
|
|
if (lineData[2 * (lineDataEndIdx - 1)] == paramX && lineData[2 * (lineDataEndIdx - 1) + 1] == paramY) {
|
2012-10-04 12:44:29 +00:00
|
|
|
*a3 = 2;
|
2013-01-11 07:16:47 +00:00
|
|
|
int posX = lineData[0];
|
|
|
|
int posY = lineData[1];
|
|
|
|
if (Ligne[idx].field6 == 5 || Ligne[idx].field6 == 1)
|
|
|
|
posY -= 2;
|
|
|
|
if (Ligne[idx].field6 == 3 || Ligne[idx].field8 == 7)
|
|
|
|
posX -= 2;
|
|
|
|
if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _vm->_objectsManager._lastLine))
|
|
|
|
error("Error in test line");
|
|
|
|
*foundLineIdx = collLineIdx;
|
|
|
|
*foundDataIdx = collDataIdx;
|
|
|
|
return idx;
|
2012-10-04 12:44:29 +00:00
|
|
|
}
|
2013-01-11 07:16:47 +00:00
|
|
|
}
|
|
|
|
return -1;
|
2012-10-04 12:44:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-02 11:44:23 +00:00
|
|
|
} // End of namespace Hopkins
|